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

Synopsis

• Function: random
• Usage:
random T
• Inputs:
• Optional inputs:
• Height => an integer, default value 10, get a random homogeneous element from a graded ring
• Density => ..., default value 1, make a random module map
• MaximalRank => ..., default value false, make a random module map
• UpperTriangular => ..., default value false, make a random module map
• Outputs:
• , a random instance of the type T

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