|
-
Aug 24th, 2001, 08:56 PM
#1
Random Numbers
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.
-
Aug 31st, 2001, 09:26 PM
#2
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.
-
Sep 1st, 2001, 06:29 AM
#3
transcendental analytic
Zaei what are you thinking of?
g1=5
g2=10
seed=42
max=10
loop[
seed=g1*g2+g2 (60)
]
return seed % max
Last edited by kedaman; Sep 1st, 2001 at 06:33 AM.
Use  
writing software in C++ is like driving rivets into steel beam with a toothpick.
writing haskell makes your life easier:
reverse (p (6*9)) where p x|x==0=""|True=chr (48+z): p y where (y,z)=divMod x 13
To throw away OOP for low level languages is myopia, to keep OOP is hyperopia. To throw away OOP for a high level language is insight.
-
Sep 4th, 2001, 03:18 PM
#4
I know. I looked it over after I posted it, and it doesnt make any sense. I copied out from GPG I. ::shrug::
Z.
-
Sep 4th, 2001, 05:06 PM
#5
transcendental analytic
besides it pseudo not psudo
Use  
writing software in C++ is like driving rivets into steel beam with a toothpick.
writing haskell makes your life easier:
reverse (p (6*9)) where p x|x==0=""|True=chr (48+z): p y where (y,z)=divMod x 13
To throw away OOP for low level languages is myopia, to keep OOP is hyperopia. To throw away OOP for a high level language is insight.
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|