Project

General

Profile

Feature #1011

Random seed fn

Added by John Abbott over 1 year ago. Updated 8 months ago.

Status:
Closed
Priority:
High
Assignee:
Category:
CoCoA-4 function to be added
Target version:
Start date:
20 Feb 2017
Due date:
% Done:

100%

Estimated time:
Spent time:

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 over 1 year 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 about 1 year ago

  • Priority changed from Normal to High
  • Target version changed from CoCoA-5.?.? to CoCoA-5.2.2

#3 Updated by John Abbott about 1 year 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 about 1 year 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 about 1 year 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 8 months ago

  • Status changed from In Progress to Closed
  • % Done changed from 50 to 100

Also available in: Atom PDF