Posts: 69
Threads: 26
Joined: Feb 2008
Have any of you written a random number generating program for a 32sii? Specifically generating an integer between say 1 to 5? I don't have the manual and wonder if it could be already in existance?
Best regards,
Charles
Posts: 30
Threads: 9
Joined: Feb 2006
It has a random number generator from 0 to 1(Prob -> R). Couldn't you just use a linear transform of that, i.e.,
Your Random Number = 1 + (4*R)
Posts: 266
Threads: 32
Joined: Jan 1970
I think you would need to compute 1+int(5*R) to get a random integer in the range 1..5. Most random number generators produce fractions from zero to one, including zero but not including one.
Posts: 93
Threads: 15
Joined: Jan 1970
Posts: 93
Threads: 15
Joined: Jan 1970
Hi!
Try it:
LBL R #random
INPUT N #how many Nums?
INPUT I #mInimum?
INPUT A #mAximum?
LBL J #jump here
RCL A
RCL sub I
1
add
RANDOM
mul
IP
RCL add I
PSE #put another PSE, if it too fast
DSE N
GTO J
RTN
'add', 'sub', 'mul', 'div' mean
'add', 'substract', 'multiple' and 'divide' in this order.
Csaba