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

random(ZZ,ZZ) -- random integer in a range

Synopsis

Description

i1 : tally apply (10, i -> random(5,2^34+5))

o1 = Tally{1857685788 => 1 }
           3866591675 => 1
           5011443619 => 1
           6040567245 => 1
           7507179624 => 1
           10802729852 => 1
           13853567097 => 1
           15075388724 => 1
           15965351148 => 1
           17081379733 => 1

o1 : Tally
Here is an example using the tally command.
i2 : tally apply(100, i -> random(10,15))

o2 = Tally{10 => 17}
           11 => 22
           12 => 10
           13 => 12
           14 => 26
           15 => 13

o2 : Tally

Caveat

doesn't correctly handle the case when the length of the range is larger than 2^31-1.

See also