[top][index]
search for:

setRandomSeed String -- set starting point for random number generator

Synopsis:

  • Usage: setRandomSeed s
  • Function: setRandomSeed -- set starting point for random number generator
  • Input:
  • s, an instance of class String.
  • Output:
  • s, an instance of class Thing.
  • Sets the random number seed to an integer computed from s. 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.

    i1 : setRandomSeed "thrkwjsxz"
    i2 : for i to 10 list random 100

    o2 = {87, 25, 83, 77, 25, 48, 96, 91, 16, 26, 82}

    o2 : List
    i3 : setRandomSeed "thrkwjsxz"
    i4 : for i to 10 list random 100

    o4 = {87, 25, 83, 77, 25, 48, 96, 91, 16, 26, 82}

    o4 : List

    Code:

         -- ../../../Macaulay2/m2/system.m2:12
         setRandomSeed String := seed -> setRandomSeed fold((i,j) -> 101*i + j, 0, ascii seed)

    [top][index]
    search for: