Core: create the per world random object in the world constructor (#2083)

* Core: create the per world random object in the world constructor

* remove the check that multiworld exists

* add a deprecation warning to per_slot_randoms

* move random import and fix conflicts

* assert worlds don't exist before setting the multiworld seed

* fix the dlcq and sdv tests

* actually use the seed
This commit is contained in:
Aaron Wagener
2024-03-10 12:47:45 -05:00
committed by GitHub
parent b8c24def8d
commit 2e1a5b0e3b
6 changed files with 16 additions and 14 deletions

View File

@@ -3,6 +3,7 @@ from __future__ import annotations
import hashlib
import logging
import pathlib
import random
import re
import sys
import time
@@ -299,6 +300,8 @@ class World(metaclass=AutoWorldRegister):
assert multiworld is not None
self.multiworld = multiworld
self.player = player
self.random = random.Random(multiworld.random.getrandbits(64))
multiworld.per_slot_randoms[player] = self.random
def __getattr__(self, item: str) -> Any:
if item == "settings":