File: setRandomSeed-doc.m2

package info (click to toggle)
macaulay2 1.25.05%2Bds-2
  • links: PTS, VCS
  • area: main
  • in suites: experimental
  • size: 172,152 kB
  • sloc: cpp: 107,824; ansic: 16,193; javascript: 4,189; makefile: 3,899; lisp: 702; yacc: 604; sh: 476; xml: 177; perl: 114; lex: 65; python: 33
file content (53 lines) | stat: -rw-r--r-- 1,871 bytes parent folder | download | duplicates (4)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
doc ///
Node
  Key
    setRandomSeed
   (setRandomSeed, Sequence)
   (setRandomSeed, String)
   (setRandomSeed, ZZ)
  Headline
    set starting point for random number generator
  Usage
    setRandomSeed()
    setRandomSeed(seed)
  Consequences
    Item
      If {\tt seed} is {\tt ()}, initializes the random number generator to a fixed state,
      identical to the initial state (upon program start) in version 1.2 and earlier of Macaulay2.
      Otherwise sets {\tt randomSeed} to a value based on {\tt seed}.
  Description
    Text
      Since version 1.2, when Macaulay2 starts the random number seed is initially set to
      a number that depends on the current date, the time (in seconds), and the process id,
      except for when running examples and tests in packages, where it is always initialized
      to 0 by passing the command line option @TT "--no-randomize"@.

      The sequence of future pseudo-random results is determined by the random number seed.
    Example
      setRandomSeed()
      random 2^100
      random 2^100
      setRandomSeed()
      random 2^100
      random 2^100
    Text
      If an integer seed is given, the random number seed is set to the low-order 32 bits of the seed.
    Example
      setRandomSeed 123456
      for i to 10 list random 100
      setRandomSeed 123456
      for i to 10 list random 100
    Text
      If a string seed is given, sets the random number seed to an integer computed from it.
      Every character of the string contributes to the seed, but only 32 bits of data are used.
      The sequence of future pseudo-random results is determined by the seed.
    Example
      setRandomSeed "thrkwjsxz"
      for i to 10 list random 100
      setRandomSeed "thrkwjsxz"
      for i to 10 list random 100
  SourceCode
    (setRandomSeed, ZZ)
    (setRandomSeed, String)
    (setRandomSeed, Sequence)
///