- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Get Direct Link
- Report Inappropriate Content
Limit to seed number
Hello everyone
I was wondering if there were an upper limit to the seed that we can define in JMP ? Can we go up to the infinite or nearby ?
I am concatenating big numbers to be able to recreate the same seed each time they occur together, but as those number are increasing with time, the seed will quickly increase as well. So far everything is running fine but I may reach values close to 10^12 or 10^13 soon enough.
thanks for your answer !
regards
Accepted Solutions
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Get Direct Link
- Report Inappropriate Content
Re: Limit to seed number
You can use the full 32-bit range (except 0), so you should get different random results for seeds from [1, 4294967295]. Beyond that it will wrap, so note that 4294967296 wraps to 0 and uses a random seed. Below is @Craige_Hales script with seeds 2^32+1 and 1 to show that the random values are the same with these two seeds.
s1 = 4294967297; s2 = 1; randomreset(s1); print("s1:",randomuniform(),randomuniform(),randomuniform()); randomreset(s2); print("s2:",randomuniform(),randomuniform(),randomuniform()); print("bits:",hex(s1), hex(s2)); // the two numbers are almost the same, in bits
"s1:"
0.883865864481777
0.973821102175861
0.507582586025819
"s2:"
0.883865864481777
0.973821102175861
0.507582586025819
"bits:"
"41F0000000100000"
"3FF0000000000000"
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Get Direct Link
- Report Inappropriate Content
Re: Limit to seed number
It is a good question, and I don't have a precise answer. But I'm pretty sure you want to stick with integers from 1 to 2147483647 (2^31-1). After experimenting a bit:
s1 = 123559868338560;
s2 = 123456789123456;
randomreset(s1);
print("s1:",randomuniform(),randomuniform(),randomuniform());
randomreset(s2);
print("s2:",randomuniform(),randomuniform(),randomuniform());
print("bits:",hex(s1), hex(s2)); // the two numbers are almost the same, in bits
"s1:"
0.810199321946129
0.909442130941897
0.272601864300668
"s2:"
0.810199321946129
0.909442130941897
0.272601864300668
"bits:"
"42DC182183E46000"
"42DC122183E46000"
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Get Direct Link
- Report Inappropriate Content
Re: Limit to seed number
You can use the full 32-bit range (except 0), so you should get different random results for seeds from [1, 4294967295]. Beyond that it will wrap, so note that 4294967296 wraps to 0 and uses a random seed. Below is @Craige_Hales script with seeds 2^32+1 and 1 to show that the random values are the same with these two seeds.
s1 = 4294967297; s2 = 1; randomreset(s1); print("s1:",randomuniform(),randomuniform(),randomuniform()); randomreset(s2); print("s2:",randomuniform(),randomuniform(),randomuniform()); print("bits:",hex(s1), hex(s2)); // the two numbers are almost the same, in bits
"s1:"
0.883865864481777
0.973821102175861
0.507582586025819
"s2:"
0.883865864481777
0.973821102175861
0.507582586025819
"bits:"
"41F0000000100000"
"3FF0000000000000"
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Get Direct Link
- Report Inappropriate Content
Re: Limit to seed number
Thanx, this is very interesting.