odiousgambit
odiousgambit
  • Threads: 327
  • Posts: 9775
Joined: Nov 9, 2009
November 18th, 2012 at 7:04:28 AM permalink
I have found using Wincraps it is often best to generate your own random numbers. I sometimes use a "keyboard smash" but clearly this could develop a non-random pattern, in that your fingers tend to hit certain numbers, and actively avoiding that could be bias.

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.
the next time Dame Fortune toys with your heart, your soul and your wallet, raise your glass and praise her thus: “Thanks for nothing, you cold-hearted, evil, damnable, nefarious, low-life, malicious monster from Hell!”   She is, after all, stone deaf. ... Arnold Snyder
s2dbaker
s2dbaker
  • Threads: 51
  • Posts: 3259
Joined: Jun 10, 2010
November 18th, 2012 at 7:31:05 AM permalink
Without knowing what the two steps are, it's difficult to evaluate given such a small sample size.

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.
Someday, joor goin' to see the name of Googie Gomez in lights and joor goin' to say to joorself, "Was that her?" and then joor goin' to answer to joorself, "That was her!" But you know somethin' mister? I was always her yuss nobody knows it! - Googie Gomez
PapaChubby
PapaChubby
  • Threads: 11
  • Posts: 496
Joined: Mar 29, 2010
November 18th, 2012 at 8:03:47 AM permalink
Given 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.
7craps
7craps
  • Threads: 18
  • Posts: 1977
Joined: Jan 23, 2010
November 18th, 2012 at 9:22:54 AM permalink
Quote: odiousgambit

I have found using Wincraps it is often best to generate your own random numbers.

I have found WC rng to be best use always.
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??
winsome johnny (not Win some johnny)
odiousgambit
odiousgambit
  • Threads: 327
  • Posts: 9775
Joined: Nov 9, 2009
November 18th, 2012 at 9:44:30 AM permalink
Quote: PapaChubby

Given 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: 7craps

Can 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].
the next time Dame Fortune toys with your heart, your soul and your wallet, raise your glass and praise her thus: “Thanks for nothing, you cold-hearted, evil, damnable, nefarious, low-life, malicious monster from Hell!”   She is, after all, stone deaf. ... Arnold Snyder
odiousgambit
odiousgambit
  • Threads: 327
  • Posts: 9775
Joined: Nov 9, 2009
November 18th, 2012 at 9:47:58 AM permalink
Quote: s2dbaker

Also, 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.
the next time Dame Fortune toys with your heart, your soul and your wallet, raise your glass and praise her thus: “Thanks for nothing, you cold-hearted, evil, damnable, nefarious, low-life, malicious monster from Hell!”   She is, after all, stone deaf. ... Arnold Snyder
7craps
7craps
  • Threads: 18
  • Posts: 1977
Joined: Jan 23, 2010
November 18th, 2012 at 10:13:27 AM permalink
Quote: odiousgambit

It's not that I do better, but I often want to run the exact same RNG.

You are talking about the seed value AND the 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"

Quote: odiousgambit

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].

I see nothing at all awkward having WC generate the seed value.
Ethier (one or the other of two)
by me or itself.



Good Luck
winsome johnny (not Win some johnny)
MangoJ
MangoJ
  • Threads: 10
  • Posts: 905
Joined: Mar 12, 2011
November 18th, 2012 at 11:20:29 AM permalink
Quote: PapaChubby

Given 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.
odiousgambit
odiousgambit
  • Threads: 327
  • Posts: 9775
Joined: Nov 9, 2009
November 18th, 2012 at 12:21:55 PM permalink
thanks for all the input.

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
the next time Dame Fortune toys with your heart, your soul and your wallet, raise your glass and praise her thus: “Thanks for nothing, you cold-hearted, evil, damnable, nefarious, low-life, malicious monster from Hell!”   She is, after all, stone deaf. ... Arnold Snyder
teliot
teliot
  • Threads: 43
  • Posts: 2871
Joined: Oct 19, 2009
November 18th, 2012 at 12:45:45 PM permalink
Quote: odiousgambit

RNG description

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.

How can your RNG duplicate a number? How can it duplicate every number in its range?
Climate Casino: https://climatecasino.net/climate-casino/
odiousgambit
odiousgambit
  • Threads: 327
  • Posts: 9775
Joined: Nov 9, 2009
November 18th, 2012 at 12:55:26 PM permalink
Quote: teliot

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.

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
the next time Dame Fortune toys with your heart, your soul and your wallet, raise your glass and praise her thus: “Thanks for nothing, you cold-hearted, evil, damnable, nefarious, low-life, malicious monster from Hell!”   She is, after all, stone deaf. ... Arnold Snyder
AxiomOfChoice
AxiomOfChoice
  • Threads: 32
  • Posts: 5761
Joined: Sep 12, 2012
November 18th, 2012 at 1:17:07 PM permalink
Quote: odiousgambit

take 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?
odiousgambit
odiousgambit
  • Threads: 327
  • Posts: 9775
Joined: Nov 9, 2009
November 18th, 2012 at 1:46:02 PM permalink
Quote: AxiomOfChoice

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?



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
the next time Dame Fortune toys with your heart, your soul and your wallet, raise your glass and praise her thus: “Thanks for nothing, you cold-hearted, evil, damnable, nefarious, low-life, malicious monster from Hell!”   She is, after all, stone deaf. ... Arnold Snyder
AxiomOfChoice
AxiomOfChoice
  • Threads: 32
  • Posts: 5761
Joined: Sep 12, 2012
November 18th, 2012 at 2:32:26 PM permalink
Your calculator probably just doesn't display the trailing 0.

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.
teliot
teliot
  • Threads: 43
  • Posts: 2871
Joined: Oct 19, 2009
November 18th, 2012 at 2:39:21 PM permalink
Here is the code for your algorithm.


#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);
}
}

This code produces 1,000,000 numbers in your sequence. It does not pass even the simplest tests for randomness. For example, the number of instances where R(N) = R(N+1) is 0. It should be about 100.
Climate Casino: https://climatecasino.net/climate-casino/
MangoJ
MangoJ
  • Threads: 10
  • Posts: 905
Joined: Mar 12, 2011
November 18th, 2012 at 3:34:49 PM permalink
pow(10,14) is terrible style. Better use 1e14.
miplet
miplet
  • Threads: 5
  • Posts: 2146
Joined: Dec 1, 2009
November 18th, 2012 at 4:02:49 PM permalink
Quote: MangoJ

pow(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.
“Man Babes” #AxelFabulous
AxiomOfChoice
AxiomOfChoice
  • Threads: 32
  • Posts: 5761
Joined: Sep 12, 2012
November 18th, 2012 at 4:16:11 PM permalink
The trick is to write it in perl so that no one (including you) can understand what it does.
odiousgambit
odiousgambit
  • Threads: 327
  • Posts: 9775
Joined: Nov 9, 2009
November 18th, 2012 at 4:35:23 PM permalink
Quote: AxiomOfChoice

I 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.
the next time Dame Fortune toys with your heart, your soul and your wallet, raise your glass and praise her thus: “Thanks for nothing, you cold-hearted, evil, damnable, nefarious, low-life, malicious monster from Hell!”   She is, after all, stone deaf. ... Arnold Snyder
teliot
teliot
  • Threads: 43
  • Posts: 2871
Joined: Oct 19, 2009
November 18th, 2012 at 5:04:02 PM permalink
Quote: odiousgambit

well, yeah, for example I used it to represent 100 different players recently. Doesnt have to be too good.

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:

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]);
}
Climate Casino: https://climatecasino.net/climate-casino/
s2dbaker
s2dbaker
  • Threads: 51
  • Posts: 3259
Joined: Jun 10, 2010
November 18th, 2012 at 5:30:47 PM permalink
I'm totally not showing you the code I wrote while attempting to create a similar randomness utilizing Fermat's conjecture.
Someday, joor goin' to see the name of Googie Gomez in lights and joor goin' to say to joorself, "Was that her?" and then joor goin' to answer to joorself, "That was her!" But you know somethin' mister? I was always her yuss nobody knows it! - Googie Gomez
odiousgambit
odiousgambit
  • Threads: 327
  • Posts: 9775
Joined: Nov 9, 2009
November 19th, 2012 at 12:42:56 AM permalink
Quote: teliot

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:...



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.
the next time Dame Fortune toys with your heart, your soul and your wallet, raise your glass and praise her thus: “Thanks for nothing, you cold-hearted, evil, damnable, nefarious, low-life, malicious monster from Hell!”   She is, after all, stone deaf. ... Arnold Snyder
teliot
teliot
  • Threads: 43
  • Posts: 2871
Joined: Oct 19, 2009
November 19th, 2012 at 7:08:00 AM permalink
Quote: odiousgambit

Well, not to roll dice but using it to seed an RNG. But this is telling, too many 2's for sure.

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.
Climate Casino: https://climatecasino.net/climate-casino/
  • Jump to: