Feature #1011
Random seed fn
Description
CoCoA-4 has a Seed
fn for resetting the global random number generator.
Make it (or something equivalent) available in CoCoA-5?
History
#1 Updated by John Abbott about 7 years ago
An interactive CoCoA-5 session will always generate the same sequence of (pseudo-)random numbers.
In CoCoA-4 there was a fn called Seed
which would restart the random number generator from the given seed.
In CoCoALib, a seed value may be given when creating a random source; or the source may be "reseeded" after construction.
The CoCoA-4 fn can be emulated by reseeding the GlobalRandomSource
in CoCoALib. This makes me suggest that we could call the fn reseed
(and perhaps put Seed
in as an obsolescent fn?)
Opinions?
#2 Updated by John Abbott almost 7 years ago
- Priority changed from Normal to High
- Target version changed from CoCoA-5.?.? to CoCoA-5.2.2
#3 Updated by John Abbott almost 7 years ago
- Status changed from New to In Progress
- % Done changed from 0 to 10
The CoCoA-5 function random
calls random_forC5
defined in CoCoALibSupplement.C
.
Presumably reseed
can be defined as a CoCoALib builtin fn, working via CoCoALibSupplement.C
.
#4 Updated by John Abbott almost 7 years ago
- Assignee set to John Abbott
- % Done changed from 10 to 50
I have implemented reseed
, and written a manual page.
Not sure about making a test... I suppose I could make an easy one.
#5 Updated by John Abbott almost 7 years ago
In the manual page I have given a simplistic example of calling reseed
with an argument which varies with the time: so two CoCoA session started at least 1 second apart will be seeded differently.
Should there be an easy way of achieving this? For instance a specific function (with no args) which reseeds from a time-dependent value? Maybe ReseedFromTime()
?
Perhaps it is not so important? The user could just copy the line from the manual...
#6 Updated by John Abbott over 6 years ago
- Status changed from In Progress to Closed
- % Done changed from 50 to 100