Click to See Complete Forum and Search --> : Random Numbers
ChimpFace9000
Aug 24th, 2001, 08:56 PM
Are there any tutorials on how to write a random number generator? All ive ever found is code for one, which i can never get to work. But id like to write my own so i can learn to write it better for each situation.
Zaei
Aug 31st, 2001, 09:26 PM
Ok, here is a simple algorithm that will return a psudo random number. First, choose a number, called g1. Double that value, and store it in g2. Choose a seed value, and a value for the maximum number to be returned. The, for each iteration, multiply g1 by g2, and add g2, and store it into seed. Do seed mod max and return that value.
Hope you understood all of that =).
Z.
kedaman
Sep 1st, 2001, 06:29 AM
Zaei what are you thinking of?
g1=5
g2=10
seed=42
max=10
loop[
seed=g1*g2+g2 (60)
]
return seed % max
Zaei
Sep 4th, 2001, 03:18 PM
I know. I looked it over after I posted it, and it doesnt make any sense. I copied out from GPG I. ::shrug::
Z.
kedaman
Sep 4th, 2001, 05:06 PM
besides it pseudo not psudo :p
vbforums.com
Copyright Internet.com Inc., All Rights Reserved.