l i n u x - u s e r s - g r o u p - o f - d a v i s
Next Meeting:
July 7: Social gathering
Next Installfest:
Latest News:
Jun. 14: June LUGOD meeting cancelled
Page last updated:
2002 Apr 04 17:56

The following is an archive of a post made to our 'vox-tech mailing list' by one of its subscribers.

Report this post as spam:

(Enter your email address)
[vox-tech] random number in C
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[vox-tech] random number in C

i wrote some monte carlo code which obtains a random generator seed
through a read to /dev/random.

on a lark, i did a run:

	T: 4.0e+00  beta: 2.500e-01  trials: 1000000
	N: 10  M: 10  seed: 208006379
	Average Energy: -1.057143
	Average magnetization: 0.002008
	Average |magnetization|: 0.251765
	Average magnetic susceptibility: 8.948655

and then in my code, i commented out the read to /dev/random and
assigned the seed to what it was above, 208006379.   i then ran the
program again:

	T: 4.0e+00  beta: 2.500e-01  trials: 1000000
	N: 10  M: 10  seed: 208006379
	Average Energy: -1.050182
	Average magnetization: 0.030723
	Average |magnetization|: 0.246092
	Average magnetic susceptibility: 8.692724

the seed for these two runs is the same.  i would've expected that calls
to rand() should've generated the same set of random numbers.  yet the
different runs of the monte carlo code yield different results, which is
fine, except i was expecting it to be exactly the same since the seed is
the same.

am i wrong about seeds yielding different sets of random numbers?

any thoughts?

it would be nice to "redo" a run.  i was under the impression that for
identical input (just the temperature) and an identical seed, two runs
should be exactly the same...

vox-tech mailing list

LUGOD Group on LinkedIn
Sign up for LUGOD event announcements
Your email address:
LUGOD Group on Facebook
'Like' LUGOD on Facebook:

Hosting provided by:
Sunset Systems
Sunset Systems offers preconfigured Linux systems, remote system administration and custom software development.

LUGOD: Linux Users' Group of Davis
PO Box 2082, Davis, CA 95617
Contact Us

LUGOD is a 501(c)7 non-profit organization
based in Davis, California
and serving the Sacramento area.
"Linux" is a trademark of Linus Torvalds.

Sponsored in part by:
O'Reilly and Associates
For numerous book donations.