So I use a simple calculator. I wonder if anyone else uses the same method. Let's say I start with 999, a non-random choice I wouldnt use. But from that in two steps I generate another number, to four places. From that number I generate the next in two steps. [actually I make it slightly more complicated than two steps and vary by whim how many places when I am doing it for Wincraps]. But let's say two steps, this generates:
[999]
7448
1575
0314
2635
9021
5023
Can anyone bet me they could find a pattern or predict a number? Possibly, because it occurs to me that others might use the same method.
PS: for Wincraps I also do not use the last number to generate the next. But here I do.
Also, do 10,000 numbers provide enough granularity? If you assign a specific roll-of-the-dice outcome to a single number, (for example, 1234 = a 3 on the first die and a 5 on the second die) then for each of the 36 possible combinations of dice throws, you'll have 10,000 / 36 or 277.777... allotted results. Most (28 of the 36) will have 278 but some (8 of the 36) will get shortchanged with 277 thus making for biased dice.
I don't know if that minuscule amount of difference is important for you but it would bug me.
I have found WC rng to be best use always.Quote: odiousgambitI have found using Wincraps it is often best to generate your own random numbers.
The HELP section in WC talks about the RNGs in WC.
some problems can happen when re-seeding new games that are less than a split-second in length.
From the website
"Version 5.0 changes:
Converted to 32 bit program resulting in significant increase in Hyper-drive speed.
Added Games Log w/ histograms, computes mean, median, mode, standard deviation, skew, etc.
Added ability to track/record all dice faces & combinations to Roll Freqs screen, Auto-Bet screen, and Dice Roll Files screen.
Added Hyper-drive throttle.
Added Mersenne Twister as RNGs #1 and #2.
Re-worked timer seeds and RNG seed routine.
Made a number of screens sizeable.
Added separate dice roll window."
Can you do as good or better than the Mersenne Twister?
If yes, why??
Quote: PapaChubbyGiven that the current number is 0314, will the two steps that you allude to always yield the number 2635? If so, then I assert that this is not a sufficient RNG. At best, you will get a repeating sequence no greater than 10,000 elements long.
yes, the result is something someone else could duplicate. Bear in mind for Wincraps use I don't re-use the last number, but make an effort to grab a different starting number, an element of outside randomization. But if you are right, no repeat for 10,000 is good for my usual purposes. And I agree that there is reason to believe some sort of repeating sequence error might arise with a simple thing like this.
Quote: 7crapsCan you do as good or better than the Mersenne Twister?
If yes, why??
It's not that I do better, but I often want to run the exact same RNG. It is awkward to have Wincraps generate a seed for an RNG, then try to save the seed [edit]. I seem to often unintentionally wind up with a different seed and don't know it [edit].
Quote: s2dbakerAlso, do 10,000 numbers provide enough granularity?
I can easily vary this to a number that is not 4 digits, and do. What I come up with, though, is an unpredictable unpicked seed which I then seed the RNG with in Wincraps. How Wincraps takes it from there I know not.
You are talking about the seed value AND the RNG#.Quote: odiousgambitIt's not that I do better, but I often want to run the exact same RNG.
That can be added into the auto-bet file so you can always use the same seed to run different sims or change it and save it.
"All RNG's accept seed values as whole numbers ranging from 1 to 2,147,483,647"
I see nothing at all awkward having WC generate the seed value.Quote: odiousgambitIt is awkward to have Wincraps generate a seed for an RNG, then try to save the seed [edit]. I seem to often unintentionally wind up with a different seed and don't know it [edit].
Ethier (one or the other of two)
by me or itself.
Good Luck
Quote: PapaChubbyGiven that the current number is 0314, will the two steps that you allude to always yield the number 2635? If so, then I assert that this is not a sufficient RNG. At best, you will get a repeating sequence no greater than 10,000 elements long.
Actually this is how all pseudo-RNG work. They are deterministic, so for the same input (the same "seed") they return the same next number - even worse: they return the same number sequence of any length. This is why they are called "pseudo" random, they aren't random (in a true sense) at all - even worse: they are periodic (and you are right, in the above case with a periodicity below 10^4).
Designing an own pseudo-RNG is a difficult task indeed. Periodicity is only one issue of them. More severe concern is bias and autocorrelation. Mersenne twister is already a good RNG with a period of 10^400 (i believe), and within that period no autocorrelation was significantly found.
There is no need to not use WinCraps RNG. The traditional way to seed the pseudo-RNG is using the system time information, which at least ensures different sequences at each run.
I noticed even as a kid that calculators generate big long figures for the square root function.
Here is my method:
Take the square root of some number. [for Wincraps I grab a number from somewhere other than last seed].
For 999 that is:
31.60696125855822
by removing the decimal point alter that to:
3160696125855822
and get the square root of that:
56220068.71087780874485
take off the last digit, if I am correct this is never zero, a bias.
56220068.7108778087448
use the last [in this case 4] digits for new seed. You can see 5 to 9 digits is also easily used.
starting with 999 I get the result 7448
About 1 time in 10k your RNG should produce the same number twice in a row (given that its output is in the range 0..10k). That should happen for each number that the RNG outputs, that is, every number in the range 0..10k should be capable of coming out twice in a row.Quote: odiousgambitRNG description
How can your RNG duplicate a number? How can it duplicate every number in its range?
Quote: teliotAbout 1 time in 10k your RNG should produce the same number twice in a row (given that its output is in the range 0..10k). That should happen for each number that the RNG outputs, that is, every number in the range 0..10k should be capable of coming out twice in a row.
How can your RNG duplicate a number? How can it duplicate every number in its range?
for the range zero to 9999 it has to duplicate a number eventually, since there are only 10000 numbers possible. To me this just seems to be by chance, especially when an effort is made to mix things up a bit, such as grabbing a number from somewhere else. Example: where the bankroll wound up on the last Wincraps run. Wincraps will give you a ton of such choices.
PS: for Wincraps usually the RNG accepts up to 9 digits and I usually seed with 8 to 9
Quote: odiousgambittake off the last digit, if I am correct this is never zero, a bias.
It's not really the "last" digit. It's the last digit that your calculator displays. There is no last digit (the square root of an integer is either an integer or irrational). I don't think it's any more or less likely to be 0 than any other number after the decimal place.
Speaking of which, what do you do if you happen to stumble onto a perfect square, so there is no decimal place to "remove". Do you treat that as 0000, or the last 4 digits of the number?
Quote: AxiomOfChoiceIt's not really the "last" digit. It's the last digit that your calculator displays. There is no last digit (the square root of an integer is either an integer or irrational). I don't think it's any more or less likely to be 0 than any other number after the decimal place.
Speaking of which, what do you do if you happen to stumble onto a perfect square, so there is no decimal place to "remove". Do you treat that as 0000, or the last 4 digits of the number?
good points.
I have observed it is never zero on the end, not that I couldnt be wrong. In any case the decision to do so is made before looking at results, to avoid bias.
I guess if I have a number that is a perfect square that I truly came across innocently, I'd use 10000 or whatever, as Wincraps won't accept a seed of zero
I would be very surprised if your method gave you good random numbers. If you really want to build a PRNG, there are well-known ways of doing this. I can see it being fun to play around with, but I wouldn't use it for anything that you care about.
If you are really interested in this, it might be fun to look at how PRNGs are tested for randomness, apply the same tests to yours, and see which (if any) it fails. You might learn something interesting about the decimal representation of square roots (if you do, please share!) I remember reading something somewhere about applying randomness tests to the digits of decimal representations of well-known transcendental numbers. I don't know if similar results would apply to irrational algebraic numbers.
#include <stdio.h>
#include <math.h>
main() {
double x;
int ctr;
int p = 999;
for (ctr = 1; ctr <= 1000000; ctr++) {
x = sqrt(sqrt(p)*pow(10,14));
x = (x - (long long int)x)*pow(10,10);
x = (x - (long long int)x)*pow(10,4);
p = (int)x;
printf("%d\n",p);
}
}
Quote: MangoJpow(10,14) is terrible style. Better use 1e14.
Like teliot once said:
Quote:...showing your code is a bit like showing your underwear
If I ever showed my code for the things I do..... I better not even mention it.
Quote: AxiomOfChoiceI can see it being fun to play around with, but I wouldn't use it for anything that you care about.
well, yeah, for example I used it to represent 100 different players recently. Doesnt have to be too good.
for something I really wanted no one to have any basis for disputing, I'd use the RNG/seeding provided by Wincraps and take care to carefully record the seed, test it, then run a trial knowing I hadnt f****d it up.
Since you are using it to throw dice, I decided to take the numbers and just mod them by 6 and tally them up. I generated six million (6,000,000) random numbers using your method. Here is the distribution:Quote: odiousgambitwell, yeah, for example I used it to represent 100 different players recently. Doesnt have to be too good.
1, 905658
2, 1245287
3, 849053
4, 849057
5, 1188678
6, 962267
And here is my underwear:
#include <stdio.h>
#include <math.h>
main() {
double x;
int ctr;
int p = 999;
int freq[7] = {};
int dice;
for (ctr = 1; ctr <= 6000000; ctr++) {
x =sqrt(sqrt(p)*pow(10,14));
x = (x - (long long int)x)*pow(10,10);
x = (x - (long long int)x)*pow(10,4);
p = (int)x;
dice = p%6 + 1;
freq[dice]++;
}
for (ctr = 1; ctr <= 6; ctr++)
printf("%d, %d\n", ctr, freq[ctr]);
}
Quote: teliotSince you are using it to throw dice, I decided to take the numbers and just mod them by 6 and tally them up. I generated six million (6,000,000) random numbers using your method. Here is the distribution:...
Well, not to roll dice but using it to seed an RNG. But this is telling, too many 2's for sure.
Bear in mind I simplified this to see if someone did something similar. I add randomizing actions when I do it for Wincraps seed, and use more than two steps.
Nonetheless it seems I am better off letting Wincraps do the seeding and just deal with it, not wanting doubters as to results.
Thanks.
It is extremely tough to write a decent RNG. Ideas that seem very random may not be random at all. There is definite value in giving it a try and seeing what happens.Quote: odiousgambitWell, not to roll dice but using it to seed an RNG. But this is telling, too many 2's for sure.