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

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

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 = .8927118418469154

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

o2 = .5619898392945591566756001377063+.2468606270337661566124209458785*ii

o2 : CC (of precision 100)
i3 : kk = GF 11

o3 = kk

o3 : GaloisField
i4 : tally for i to 100 list random kk

o4 = Tally{-1 => 4 }
           -2 => 11
           -3 => 8
           -4 => 10
           -5 => 15
           0 => 6
           1 => 7
           2 => 11
           3 => 8
           4 => 12
           5 => 9

o4 : Tally
i5 : random GF(2,40)

      37    35    33    31    29    27    24    22    17    16    15    12  
o5 = a   + a   + a   + a   + a   + a   + a   + a   + a   + a   + a   + a   +
     ------------------------------------------------------------------------
      5    4    2
     a  + a  + a  + a

o5 : GF 1099511627776

See also

Ways to use this method:


The source of this document is in Macaulay2Doc/functions/random-doc.m2:262:0.