Macaulay2 » Documentation
Packages » random > random(Type)
next | previous | forward | backward | up | index | toc

random(Type) -- get a random object of a type

Synopsis

Description

If the Height option specifies a number h and T is ZZ then the integers returned are in the range [0, h); for QQ the numerator and denominator are in the range [1, h].

i1 : random RR

o1 = .892711841846915

o1 : RR (of precision 53)
i2 : random CC_100

o2 = .561989839294559156675600137706+.246860627033766156612420945879*ii

o2 : CC (of precision 100)
i3 : tally for i to 100 list random GF 11

o3 = Tally{-1 => 1}
           -1 => 1
           -1 => 1
           -1 => 1
           -1 => 1
           -1 => 1
           -1 => 1
           -1 => 1
           -1 => 1
           -2 => 1
           -2 => 1
           -2 => 1
           -2 => 1
           -2 => 1
           -2 => 1
           -2 => 1
           -2 => 1
           -2 => 1
           -2 => 1
           -2 => 1
           -2 => 1
           -2 => 1
           -2 => 1
           -2 => 1
           -3 => 1
           -3 => 1
           -3 => 1
           -3 => 1
           -3 => 1
           -3 => 1
           -3 => 1
           -3 => 1
           -4 => 1
           -4 => 1
           -4 => 1
           -4 => 1
           -4 => 1
           -4 => 1
           -4 => 1
           -4 => 1
           -4 => 1
           -4 => 1
           -5 => 1
           -5 => 1
           -5 => 1
           -5 => 1
           -5 => 1
           -5 => 1
           -5 => 1
           -5 => 1
           -5 => 1
           -5 => 1
           -5 => 1
           0 => 1
           0 => 1
           0 => 1
           0 => 1
           0 => 1
           0 => 1
           1 => 1
           1 => 1
           1 => 1
           1 => 1
           2 => 1
           2 => 1
           2 => 1
           2 => 1
           2 => 1
           2 => 1
           2 => 1
           3 => 1
           3 => 1
           3 => 1
           3 => 1
           3 => 1
           3 => 1
           3 => 1
           3 => 1
           4 => 1
           4 => 1
           4 => 1
           4 => 1
           4 => 1
           4 => 1
           4 => 1
           4 => 1
           4 => 1
           4 => 1
           4 => 1
           5 => 1
           5 => 1
           5 => 1
           5 => 1
           5 => 1
           5 => 1
           5 => 1
           5 => 1
           5 => 1
           5 => 1
           5 => 1
           5 => 1

o3 : Tally
i4 : random GF(2,40)

      36    35    32    29    26    24    21    20    17    16    11    10  
o4 = a   + a   + a   + a   + a   + a   + a   + a   + a   + a   + a   + a   +
     ------------------------------------------------------------------------
      9    7    5    2
     a  + a  + a  + a  + 1

o4 : GF 1099511627776

See also

Ways to use this method: