idle wrote:That doesn't work!
The common multiple is 35 so you need to do random5() seven times
and then mod it
Hi, I've really thought this are seven times...
Code: Select all
Procedure Random5()
ProcedureReturn Random(4)+1
EndProcedure
Procedure Random7()
;common multiple 5*7
For a = 0 To 6
Debug Str(a+1)+" time"+Mid("s",1,a)
b + Random5()
Next
b%7+1
ProcedureReturn b
EndProcedure
Debug Random7()
idle wrote:A random distribution is supposed to be a normal distribution
Yes, of course (should have added some more

above) - otherwise all these things would be correct:
Code: Select all
Procedure Random7()
CompilerSelect #RandomType
CompilerCase #AbsolutePseudo
ProcedureReturn 2
CompilerCase #Simple
ProcedureReturn Random5()
CompilerCase #SimpleAndCentered
ProcedureReturn Random5()+1
CompilerCase #Crazy
ProcedureReturn (ElapsedMilliseconds()*Random5())%7+1
CompilerEndSelect
EndProcedure