You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
The use of Use doesn't result in deterministic behavior even if one calls BaseFactory.seed_random(some_seed). This is due to how we're implementing seed_random. We create a new Random instance with the given seed instead of reseeding the existing instance. This means that the cls.random.choice function that's referenced is the method associated with the Random instance before we call seed_random. Thus, you don't get the deterministic behavior.
This should be fixed so that seed_instance reseeds the existing random instance we have instead of creating a new one.
shouldn't
ModelFactory.seed_random(10)
make the above work?it only works doing like @Alc-Alc said
But this gives an warning: https://docs.astral.sh/ruff/rules/lambda-assignment/ and it's a little bit ugly.
Originally posted by @JobaDiniz in #578 (reply in thread)
The use of
Use
doesn't result in deterministic behavior even if one callsBaseFactory.seed_random(some_seed)
. This is due to how we're implementing seed_random. We create a new Random instance with the given seed instead of reseeding the existing instance. This means that the cls.random.choice function that's referenced is the method associated with the Random instance before we call seed_random. Thus, you don't get the deterministic behavior.This should be fixed so that
seed_instance
reseeds the existing random instance we have instead of creating a new one.Note
While we are open for sponsoring on GitHub Sponsors and
OpenCollective, we also utilize Polar.sh to engage in pledge-based sponsorship.
Check out all issues funded or available for funding on our Polar.sh dashboard
The text was updated successfully, but these errors were encountered: