Re: Seeding the pseudorandom number generator
- From: chase321 <cvbrady suddenlink net>
- To: gnumeric-list gnome org
- Subject: Re: Seeding the pseudorandom number generator
- Date: Sun, 18 May 2008 17:22:30 -0700 (PDT)
Hal Ashburner-2 wrote:
chase321 wrote:
I have been using Gnumeric for some time in the statistics classes I
teach.
This past semester, I did my first online section, and had them submit
labs
using Gnumeric. For one lab, I had them use the "randbetween" function
to
generate random numbers. 9 of the 17 labs I received had identical sets
of
random numbers. This makes me more than a little suspicious, but I have
also seen students get the same sequence of numbers in the classroom. I
know enough about pseudorandom number generators to know that if two
people
start at the same point in the sequence, they're going to get the same
set
of numbers. So I have two questions.
1) How is the pseudorandom number generator initialized (seeded)?
2) Is there any way to seed it manually? I can find no function for this
mentioned in the manual.
Thanks for any help.
Hi Chase,
Looking at the code in plugins/fn-random/functions.c and src/mathfunc.c
it appears rand_01 is the relevant function. By setting the environment
variable GNUMERIC_PRNG_SEED
(on unix with a bourne compatible shell with something like
$ export GNUMERIC_PRNG_SEED=some_random_string
) will cause rand_01 to use a pseudo random number generator using the
specified seed. Otherwise it should get its random numbers from
/dev/urandom
My understanding of this is that if GNUMERIC_PRNG_SEED is set then each
time you open a sheet containing randbetween you will get the same
value, whereas if it isn't then you won't.
Are you using windows by any chance?
Kind regards,
Hal
I'm using Linux, but most if not all of my students are using Windows.
What I actually had them do is generate the random numbers and then copy
and paste "as value" so the numbers would stay fixed for the rest of the
activity. So I should be getting the actual numbers that they got. Of
course, if one of them did the lab and then passed the finished product
around to the others, that would certainly explain it, but I don't want to
claim that if I'm not sure.
Would the Windows installer set the environmental variable? I can check
tomorrow to see if it's set on my Windows machine at the office.
Incidentally, grades are already in, so I won't be taking this to the dean
at this point, but I would like to know what's going on.
Thanks for the quick reply!
--Chase
_______________________________________________
gnumeric-list mailing list
gnumeric-list gnome org
http://mail.gnome.org/mailman/listinfo/gnumeric-list
--
View this message in context:
http://www.nabble.com/Seeding-the-pseudorandom-number-generator-tp17307988p17309396.html
Sent from the GnuMeric mailing list archive at Nabble.com.
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]