this is faster. depends on what you are trying to do but an array of pre-generated random numbers will always win the day.
this is slightly faster
Local RandArray:Int[] = New Int[10000] For x = 0 To 9999 RandArray[x] = Rand(0,255) Next t1=MilliSecs() For i=1 To 2000000 rc:+1 If rc>9999 Then rc=0 pos=RandArray[rc] Print pos 'pos=(pos+7) Mod 256 Next t2=MilliSecs() Print t2-t1
this is slightly faster
t1=MilliSecs() For i=1 To 2000000 pos=BillRand(0,255) 'pos=(pos+7) Mod 256 Next t2=MilliSecs() Print t2-t1 Function BillRand( min_value,max_value=1 ) Local delta!=Float(max_value)-Float(min_value) If delta>0 Return RndFloat()*(1+delta)+min_value Return RndFloat()*(1-delta)+max_value End Function