How do you set the seed of the random number generator for giac. I want to specifically used ranm and rand but I get the impression that I am using randseed wrongly.
Code : Tout sélectionner
from giacpy import randseed
randseed(123)
In Xcas, randseed and srand both will return the seed that I give. But in python this is not happening and so I get a different random number even if I have the same seed set. Here is what I get in python:
Code : Tout sélectionner
>>> from giacpy import rand, randseed
>>> randseed(12)
1648307537
>>> rand(111)
67
>>> randseed(12)
615922008
>>> rand(111)
41
Code : Tout sélectionner
randseed(12)
12
rand(111)
88
randseed(12)
12
rand(111)
88
rand(111)
51