The seed is re-set upon running each test file. So as far as I can tell
setting the seed inside a test file should not compromise anything.
On 04.06.2012 02:11, smichr wrote:
The runtest script uses random ordering of tests and assigns a random
seed to the random number generator at the start. However, there are
several places (most in mpmath) where the seed is reset. This essential
guarantees that the tests run *after* that reset are always run in the
same order, regardless of the seed that the testing process started with.
>>> def foo():
... import random
... random.seed(0)
...
>>> import random
>>> random.seed(0)
>>> random.random()
0.84442185152504812
>>> foo() # this resets the seed so we get the same random number again
>>> random.random()
0.84442185152504812
I've removed this misuse of seed in sympy's code (and made a patch to
compatibility to allow the same seed to generate the same randint,
etc..., under different versions of python at
https://github.com/sympy/sympy/pull/1310) but am not sure what to do
about mpmath. Perhaps the test runner could be patched to getstate
before running mpmath and setstate afterwards?
/c
--
You received this message because you are subscribed to the Google
Groups "sympy" group.
To view this discussion on the web visit
https://groups.google.com/d/msg/sympy/-/mQbxWO4FecAJ.
To post to this group, send email to [email protected].
To unsubscribe from this group, send email to
[email protected].
For more options, visit this group at
http://groups.google.com/group/sympy?hl=en.
--
You received this message because you are subscribed to the Google Groups
"sympy" group.
To post to this group, send email to [email protected].
To unsubscribe from this group, send email to
[email protected].
For more options, visit this group at
http://groups.google.com/group/sympy?hl=en.