Err, can't you just compare them? If it only *seems* that values differ
then there could be any number of other reasons for the differences you
observe.
My project is a simulation. I have a "dump" from a correct simulator. I can compare my dump with theirs.
Part of the simulation includes random number generation. To solve this, the spec gives you their random number generation system to use for the purposes of testing. Dumps do not include random numbers that were generated.
My simulation agrees with theirs for 938 turns. At 939, we diverge. The step we part on is 90% about random number generation and I've tried to verify everything else to the best of my ability.
I am "guessing", but I think it's a good guess.
Bignum ist just integer numbers. AFAIK there is no such thing as a
precision for this - all digits are correct.
Well, when you divide two Integers you can get a decimal, right? My understanding was that "big math" libraries cut off the division at some point, to keep from choking on repeating decimal results. Please correct me, if I misunderstand.
Here's a look at my math:
def initialize()
# non-related setup work here
@random_seeds = [ 12345 ]
end
# and later
def test_random(limit)
until @random_seeds.size == 5
@random_seeds.push @random_seeds[-1] * 22695477 + 1
end
@random_seeds.shift
return ((@random_seeds[-1] / 65536) % 16384) % limit
end
test_random() is written to the provided specification, returning an integer between 0 and limit.
The spec include the first 100 answers, which I agree with. In fact, we agree much farther than that. As I said it takes 939 turns for us to disagree and the random number generator can be used many times in a turn.
I believe we see above that @random_seeds should always contain Bignums (after the initial few Fixnums, of course).
What you've made me wonder is, what stages does the last line go through? Does that first division produce a Float? If so, that's probably my error right there.
Thanks for your help.
James Edward Gray II
···
On Sep 15, 2004, at 10:39 AM, Robert Klemme wrote: