![[next]](next.gif)
![[previous]](previous.gif)
![[up]](up.gif)
![[top]](top.gif)
random n -- yields a random integer in the range 0 .. n-1.
Warning: doesn't correctly handle the case when n an integer is larger than 2^31-1.
i1 : tally apply(100, i -> random 10) |
Synopsis of use:
Code:
-- ../m2/integers.m2:62-64
random ZZ := ZZ => x -> (
if x <= 0 then error "expected a positive number";
randomint() % x)
![[next]](next.gif)
![[previous]](previous.gif)
![[up]](up.gif)
![[top]](top.gif)