flat assembler
Message board for the users of flat assembler.
Index
> Main > 64bit Random Number Generation |
Author |
|
kohlrak 26 Jul 2006, 05:57
not sure how your program works (need to read the assembly docs i found). Lemme tell you how most generators work. Usually, they have a fancy aligoritham that uses the number of how long it took for a certain part of the program to be called after the program has started... or something like that... C++'s rand() had this problem... If you had a program that assigned a random number to a variable immediatly at the start of the program, it would be the same every time, despite it was supposed to be a random number generator. Basically, what i liked to do was "srand(GetTickCount())" after using user input. Then it would base the number on from how long the computer has been running. Basically, no matter how your program generates random number(s), it needs user input to make it even more random.
|
|||
26 Jul 2006, 05:57 |
|
UCM 26 Jul 2006, 12:35
His function takes an input as well, which is the previous result, or for the first call the seed (GetTickCount, RDTSC, etc..)
|
|||
26 Jul 2006, 12:35 |
|
r22 30 Jul 2006, 01:05
As I suspected, it's practically perfect.
|
|||
30 Jul 2006, 01:05 |
|
mattst88 30 Jul 2006, 03:55
kohlrak wrote: not sure how your program works (need to read the assembly docs i found). Lemme tell you how most generators work. Usually, they have a fancy aligoritham that uses the number of how long it took for a certain part of the program to be called after the program has started... or something like that... C++'s rand() had this problem... If you had a program that assigned a random number to a variable immediatly at the start of the program, it would be the same every time, despite it was supposed to be a random number generator. Basically, what i liked to do was "srand(GetTickCount())" after using user input. Then it would base the number on from how long the computer has been running. Basically, no matter how your program generates random number(s), it needs user input to make it even more random. Anyone who didn't know this, raise your hand. You're preaching to the choir, man. |
|||
30 Jul 2006, 03:55 |
|
r22 01 Aug 2006, 00:12
Is it me or did people reply WITHOUT even reading my post?
|
|||
01 Aug 2006, 00:12 |
|
mattst88 01 Aug 2006, 00:44
It would seem you are correct. I'm not an assembly master, so I have to assume your code is better than what I would be able to write.
|
|||
01 Aug 2006, 00:44 |
|
< Last Thread | Next Thread > |
Forum Rules:
|
Copyright © 1999-2024, Tomasz Grysztar. Also on GitHub, YouTube.
Website powered by rwasa.