|
-
April 22nd, 2010, 10:36 AM
#1
Random Numbers
First I will say, I moderate a physics discussion forum, and we always have crackpots posting crap about quantum mechanics and their new theory of relativity. I can appreciate, then, how random number generation may be a similar lightning rod in a forum such as this.
However ( )
I had this idea about getting random numbers, which doesn't work. I have an idea WHY it doesn't work, but I'd like confirmation.
Suppose (in C++) I do the following
Code:
int myVar = 5;
int *myPointer = 0;
myPointer = myVar;
Now myPointer is a pointer to an address, which is confirmed:
gives (and I quote)
Addresses are assigned (presumably) every time the program is run, and because there are a whole host of background processes running, I would EXPECT that this would give me a random place at some point in the stack (is that the right word?).
But this doesn't happen. When I run the program again, it gives me the same address. Now, a pragmatist would give up and say ``use boost/random'', which is good, but I'm a physicist which means these kind of things keep me up at night.
Now that I've mentioned boost/random, I have an additional question, which makes me think that my idea for generating random numbers isn't wholly wrong: the boost random number generator (as near as I can tell) returns a random integer between 1 and 6. So either they're overly concerned with rolling dice, or they're doing something with hexadecimal numbers, which (to me) suggests the memory addresses above.
Thanks in advance!
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
|