CoCoA:Seed
From ApCoCoAWiki
Seed
seed for Rand
Description
This function seeds the random number generator, <ttref>Rand</ttref>.
NB: every time you restart CoCoA the sequence of random numbers will
be the same (as in other programming languages). If you want total
randomness see the example below.
Example
Seed(5); Rand(); 1991603592 ------------------------------- Rand(); -1650270230 ------------------------------- Seed(5); -- with the same seed, <quotes>Rand</quotes> generates the same sequence Rand(); 1991603592 ------------------------------- Rand(); -1650270230 ------------------------------- -- Total randomness: -- the following shows how to make a ramdom seed based on the date. D := Date(); D; Mon Mar 02 14:43:44 1998 ------------------------------- Seed(Sum(Ascii(D)));
Syntax
Seed(N:INT):INT
<type>integer</type> <type>miscellaneous</type>