next | previous | forward | backward | up | index | toc

# random(ZZ,ZZ) -- get a random integer or real number

## Synopsis

• Function: random
• Optional inputs:
• Density => ..., default value 1, get a random map of module
• Height => ..., default value 10, get a random homogeneous element from a graded ring
• MaximalRank => ..., default value false, get a random map of module
• UpperTriangular => ..., default value false, get a random map of module

## Synopsis

• Usage:
random(low, high)
random high
• Inputs:
• Outputs:

If only high is given, the output will be in the range [0, high).

 i1 : random 57 o1 = 43 i2 : random 10^50 o2 = 27966429632588001730589592232989755722230769700437 i3 : tally apply(100, i -> random 7) o3 = Tally{0 => 9 } 1 => 16 2 => 11 3 => 15 4 => 14 5 => 11 6 => 24 o3 : Tally i4 : random 3.14 o4 = 2.00442043654275 o4 : RR (of precision 53) i5 : random 3p200 o5 = 2.36205053124502582315258035615520745776119608181772539683754 o5 : RR (of precision 200)

If, in addition, low is given, the output will be in the range [low, high]

 i6 : for i to 10 list random(100,200) o6 = {195, 135, 192, 166, 106, 140, 103, 170, 125, 199, 160} o6 : List i7 : tally apply(100, i -> random(10,15)) o7 = Tally{10 => 20} 11 => 17 12 => 14 13 => 12 14 => 21 15 => 16 o7 : Tally i8 : random(10.,20.) o8 = 10.7510624000419 o8 : RR (of precision 53) i9 : random(10p100,20p100) o9 = 17.0331906463037320747251282121 o9 : RR (of precision 100)