FWIW, I just wrote a module for random numbers, because I'm a horrible sadist (only works on Unix system, BTW, and not Solaris):
import "class" : new ;
import numbers ;
import regex ;
local rule time ( ) {
local time = [ SPLIT_BY_CHARACTERS [ SHELL "date +%s%3N" ] : "\n" ] ;
return $(time[0]) ;
}
local rule mul ( a b ) {
local res = 0 ;
for local _ in [ numbers.range 1 $(b) ] {
res = [ CALC $(res) + $(a) ] ;
}
return $(res) ;
}
local rule mod ( a b ) {
while [ numbers.less $(b) $(a) ] {
a = [ CALC $(a) - $(b) ] ;
}
return $(a) ;
}
local rule trimtime ( time ) {
return [ regex.match "(.....|....|...|..|.)$" : $(time) : 1 ] ;
}
local rule tostate ( x ) { return [ mod $(x) 101 ] ; }
state = [ tostate [ trimtime [ time ] ] ] ;
rule random ( ) {
state = [ tostate [ mul $(state) 7 ] ] ;
return [ CALC $(state) - 1 ] ;
}