Pseudorandom Hash?
Monkey Forums/Monkey Programming/Pseudorandom Hash?
| ||
| Does anyone have anything for a repeatable pseudorandom hash? I have this right now:
' prand - pseudorandom number generator
' initialize on startup (oncreate)
Global testrand:prandom = New prandom
Function Main()
For Local i = 1 To 100
Print testrand.Prand(1000)
next
End
Class prandom
Global numlist:Int[10000]
Global counter:int
Method New()
For Local i=1 To 10000
numlist[i]=Rnd(100000000)
Next
End Method
Method Prand(num:Int)
counter = counter + 1
If counter > 9999 counter = 0
Return numlist[counter] Mod num
End Method
End ClassThis is probably good enough for my purposes. Is the nonrandom number generator in Monkey consistent between different devices? Will it always stay consistent? |