main(){ int i, j, a, b, move, s[10], maxgaps[10], currgaps[10]; int trials = 15000; int specialcurrgaps = 0; int specialmaxgaps = 0; srand(time(NULL)); /* Some stats of clockwise moves */ for (i = 0; i < 10; i++) { s[i] = 0; maxgaps[i] = 0; currgaps[i] = 0; } b = rand()%10; /* Generate a stream of random digits between 0 and 9 */ for (i = 0; i < trials; i++) { a = rand()%10; if (b > a) { move = 10 + a - b; } else { move = a - b; } s[move]++;

/* Update gaps */

/* The gap for move has ended, check to see if new longest gap */ if (currgaps[move] > maxgaps[move]) { maxgaps[move] = currgaps[move]; }

/* Update all gaps */ for (j = 0; j < 10; j++) { if (j == move) { currgaps[j] = 0; } else { currgaps[j]++; } } /* Now check for gaps 6, 7 and 8 all active at once */ if ((move != 6) && (move != 7) && (move != 8)) { specialcurrgaps++; } else { if (specialcurrgaps > specialmaxgaps) { specialmaxgaps = specialcurrgaps; specialcurrgaps = 0; }

b = a; }

/* Print results of trials */ printf(" %i trials\n", trials ); printf ("\nSpecial Gap Max Size: %i\n", specialmaxgaps ); }

__________

Presented 'AS IS' and for Entertainment Purposes Only. Any gain or loss is your responsibility. Use at your own risk.

Order is a Subset of Chaos Knowledge is Beyond Belief Wisdom is Not Censored Douglas Paul Smallish Jehocifer

United States Member #171734 January 11, 2016 127 Posts Offline

Posted: January 17, 2016, 10:54 pm - IP Logged

Quote: Originally posted by JADELottery on January 17, 2016

"An example of a non-random stream of numbers is a stream of constants. Adding a stream of constants to a stream of random numbers does not produce a non-random output stream."

no, they can be anything.

"As a starting point, consider two lists of length 1. a and b. a is a constant and b is a random number. Adding them produces a random number. The same is true regardless of the lengths of the lists."

no, there's only one list to work {d_{0}, d_{1}, d_{2}, d_{3}, d_{4}, ...}.

"You new claim is that "a can be any value at any point in the data". That is not the definition of a non-random number. A non-random number has a predictable value and can't have "any value at any point"."

no, nothing new here, the 'd' values in {d_{0}, d_{1}, d_{2}, d_{3}, d_{4}, ...} can be anything.

"If a() is a discrete function it would not be random. a(n) + b(n) would generate a sum that is random with a distribution around a() instead of the normal set of random numbers people generate that have a distribution around a fixed number. But the result is also random. The position of an electron is represented by a probability distribution function that does not have a distribution around a fixed number but instead it is a distribution around the equation describing the orbit for a particular electron shell."

no, we never used 'a' as a function, only a value in a function, (b - a).

no + no + no + no = invalid.

You asserted that subtracting a random number from a non-random number results in a non-random number

It doesn't.

Regardless of whether your list of numbers is some jumble of random and non-random numbers or two separate lists, one of random and the other of non-random, in the end you are doing SINGLE operations

Specifically subtracting ONE random number from ONE non-random number

If subtracting 2 from every random number in a list doesn't make the list non-random then it is FALSE that subtracting a non-random number from a random number makes the result non-random.

You seem to be focused on the fact that in your case you don't know what the pattern is to the non-random numbers and apparently don't even know what numbers are random and what numbers aren't. You are also bothered by me using a list of non-random numbers that is obviously non-random, namely a constant and also bothered by the fact that in your case that can't possibly happen (I agree). That's fine that it can't happen but it doesn't change the fact that subtracting a random number from a non-random number doesn't result in a non-random number.

Not going to argue that further as it is irrelevant.

So back to your case, you have a list and believe some numbers in the list are random and some are not (or maybe you think they are all not random) but don't know which ones are and which ones are not. So you subtract adjacent samples and do some math to fit their difference into a range of 0 to 9. You believe that if there are non-random samples in the original set then this set of differences will also have non-random elements. You apparently can't detect which numbers are not random in the original data and believe that doing this modified form of gap analysis could show anomalies in the gaps of the difference data set.

Am I close?

OK, nothing wrong with that. Though there are a lot of existing tests for randomness I'd run before conjuring up my own.

So you run your analysis and think you see something unusual.

That takes use right back to answering the question, is it really unusual?

So I provided the mathematical probability of such a thing occurring and while I may have missed some posts, I don't believe I've seen a response to that.

My analysis said if you look at a set of 27 consecutive clockwise moves that the chances of seeing no moves of 6,7 or 8 in that sequences is 1 in 15,000

Agree or disagree with that and if you disagree, explain why

main() { int i, j, a, b, move, s[10], maxgaps[10], currgaps[10]; int trials = 15000; int specialcurrgaps = 0; int specialmaxgaps = 0;

srand(time(NULL)); /* Some stats of clockwise moves */

for (i = 0; i < 10; i++) { s[i] = 0; maxgaps[i] = 0; currgaps[i] = 0; }

b = rand()%10;

/* Generate a stream of random digits between 0 and 9 */ for (i = 0; i < trials; i++) { a = rand()%10; if (b>a) { move = 10 + a - b; } else { move = a - b; }

s[move]++;

/* Update gaps */

/* The gap for move has ended, check to see if new longest gap */ if (currgaps[move] > maxgaps[move]) { maxgaps[move] = currgaps[move]; }

/* Update all gaps */ for (j = 0; j < 10; j++) { if (j == move) { currgaps[j] = 0; } else { currgaps[j]++; } }

/* Now check for gaps 6, 7 and 8 all active at once */ if ((move != 6) && (move != 7) && (move != 8)) { specialcurrgaps++; } else { if (specialcurrgaps > specialmaxgaps) { specialmaxgaps = specialcurrgaps; } specialcurrgaps = 0; } b = a; }

/* Print results of trials */ printf(" %i trials\n", trials ); printf ("\nSpecial Gap Max Size: %i\n", specialmaxgaps ); }

__________

Presented 'AS IS' and for Entertainment Purposes Only. Any gain or loss is your responsibility. Use at your own risk.

Order is a Subset of Chaos Knowledge is Beyond Belief Wisdom is Not Censored Douglas Paul Smallish Jehocifer

United States Member #171734 January 11, 2016 127 Posts Offline

Posted: January 18, 2016, 12:16 pm - IP Logged

Quote: Originally posted by JADELottery on January 17, 2016

Ok, look at it tomorrow.

Tied from 15hrs work yesterday and last night.

Initially, we do see a problem.

I've modified the code, it doesn't change what I compute but I've made it more flexible:

1) You can specify the sample size, such as 15000, on the command line

2) You can specify the number of runs to make, such as 1000. It prints the max for each run, pipe it to a file to analyze

3) You can specify each of the "moves" on the command line, such as 6 7 8. This lets you do other interesting things such as make 2 or 3 of them the same so you are only looking at one (such as 7 7 7) or 2 (such as 6 7 7) and of course you can look at any set of three (such as 1 4 10)

4) Rather than compute the "clockwise move" I put the values in a lookup table. I did this for a specific reason, to let you convince yourself that you can get exactly the same result (some long gap of missing values) even with a random combinations of 1-10 in each row. You have to manually change the table in the code, I may produce a version that gives you the command line option of randomizing them.

5) I sum up all the maxgaps and print the average at the end of all the runs

By piping the results to a file you can import them to a spreadsheet and plot the data, values along the x-axis, number of times a value appears on the y-axis and you should see a normal distribution appear. If I have time I'll do so and post a screenshot of the graph produced.

For a sequence of 15,000 samples the average maximum gap is about 24.7 when run 10,000 times.

For a sequence of 100,000 samples the average maximum gap is about 30 when run 10,000 times (number of runs just produces a "better" average, you don't need that many runs to get a good average).

Remember, you would have noticed a 1,2,3 gap or a 2,3,4 gap or a 3,4,5 gap or ... 8,9,10 gap just as easily as 6,7,8 so the probability of ANY of those triplets having a gap of 27 is substantially greater than 1 in 15000.

I'll try posting the code properly formatted in the next message

United States Member #171734 January 11, 2016 127 Posts Offline

Posted: January 18, 2016, 12:24 pm - IP Logged

I give up trying to post with indents visible, using the source code button doesn't help. Since C doesn't care about indentation this is just a bit less readable but perfectly compileable as it is. If you run it without any command line options it will give you a Usage statement

/* Validate the inputs */ if (numsamples < 2) { printf( "numsamples is %i, must be > 1\n", numsamples ); return -1; }

if (numruns < 1) { /* Check for an invalid number of runs */ printf( "Specified numruns value of %i is invalid, must be > 0\n", numruns ); return -1; }

if ((val1<1) || (val1>10) || (val2<1) || (val2>10) || (val3<1) || (val3>10)) { printf( "values to check must be in the range of 1-10, you provided %i, %i, %i\n", val1, val2, val3 ); return -1; }

}

printf ("Running test with %i samples, %i times for values of %i, %i, %i\n", numsamples, numruns, val1, val2, val3 ); sum = 0;

/* Run the test numruns times */ for (i=0; i<numruns; i++) {

/* Initialize for new run */ currgap = 0; maxgap = 0;

/* Get the first sample, samples have a range of 0-9 */ b = rand()%10;

/* Run the test for numsamples-1 (we already have the first sample) */ for (j=0; j<(numsamples-1); j++) {

/* Get next sample */ a = rand()%10;

/* Look up value from lookup[][] matrix */ value = lookup[a][b];

/* Does it match one of our values, if so any current gap is complete */ if ((value==val1) || (value==val2) || (value==val3)) {

/* Check to see if the current gap is bigger than our longest gap found so far */ if (currgap > maxgap) maxgap = currgap; /* We have a new maxgap */

currgap = 0; } /* Otherwise, bump the current gap length */ else currgap++; }

/* Our run is complete, print the maxgap found */ sum += maxgap; printf( "%i\n", maxgap ); }

/* Print the average maxgap found */ printf( "\nAverage maxgap: %f\n", (float)sum/(float)numruns ); }

West Concord, MN United States Member #21 December 7, 2001 3675 Posts Offline

Posted: January 18, 2016, 12:53 pm - IP Logged

Quote: Originally posted by dddwww on January 18, 2016

I give up trying to post with indents visible, using the source code button doesn't help. Since C doesn't care about indentation this is just a bit less readable but perfectly compileable as it is. If you run it without any command line options it will give you a Usage statement

/* Validate the inputs */ if (numsamples < 2) { printf( "numsamples is %i, must be > 1\n", numsamples ); return -1; }

if (numruns < 1) { /* Check for an invalid number of runs */ printf( "Specified numruns value of %i is invalid, must be > 0\n", numruns ); return -1; }

if ((val1<1) || (val1>10) || (val2<1) || (val2>10) || (val3<1) || (val3>10)) { printf( "values to check must be in the range of 1-10, you provided %i, %i, %i\n", val1, val2, val3 ); return -1; }

}

printf ("Running test with %i samples, %i times for values of %i, %i, %i\n", numsamples, numruns, val1, val2, val3 ); sum = 0;

/* Run the test numruns times */ for (i=0; i<numruns; i++) {

/* Initialize for new run */ currgap = 0; maxgap = 0;

/* Get the first sample, samples have a range of 0-9 */ b = rand()%10;

/* Run the test for numsamples-1 (we already have the first sample) */ for (j=0; j<(numsamples-1); j++) {

/* Get next sample */ a = rand()%10;

/* Look up value from lookup[][] matrix */ value = lookup[a][b];

/* Does it match one of our values, if so any current gap is complete */ if ((value==val1) || (value==val2) || (value==val3)) {

/* Check to see if the current gap is bigger than our longest gap found so far */ if (currgap > maxgap) maxgap = currgap; /* We have a new maxgap */

currgap = 0; } /* Otherwise, bump the current gap length */ else currgap++; }

/* Our run is complete, print the maxgap found */ sum += maxgap; printf( "%i\n", maxgap ); }

/* Print the average maxgap found */ printf( "\nAverage maxgap: %f\n", (float)sum/(float)numruns ); }

We'll examine this too.

We ran a different calculation based on each 6, 7, and 8's probability of not occurring for a period of draws up to the moment the set returned and come up with an approximate odds of those happening at about the same draw period as around 1 : 1,329,082.

Presented 'AS IS' and for Entertainment Purposes Only. Any gain or loss is your responsibility. Use at your own risk.

Order is a Subset of Chaos Knowledge is Beyond Belief Wisdom is Not Censored Douglas Paul Smallish Jehocifer

West Concord, MN United States Member #21 December 7, 2001 3675 Posts Offline

Posted: January 18, 2016, 1:16 pm - IP Logged

Quote: Originally posted by JADELottery on January 18, 2016

We'll examine this too.

We ran a different calculation based on each 6, 7, and 8's probability of not occurring for a period of draws up to the moment the set returned and come up with an approximate odds of those happening at about the same draw period as around 1 : 1,329,082.

this is also true for any 3, the odds might be higher if we tie it down to 3 consecutive; more specifically, exactly 6, 7 and 8.

rough estimate would be around 1 : 1,329,000,000.

Presented 'AS IS' and for Entertainment Purposes Only. Any gain or loss is your responsibility. Use at your own risk.

Order is a Subset of Chaos Knowledge is Beyond Belief Wisdom is Not Censored Douglas Paul Smallish Jehocifer

West Concord, MN United States Member #21 December 7, 2001 3675 Posts Offline

Posted: January 18, 2016, 2:11 pm - IP Logged

so everyone can see this in a different way than the graph, we highlighted the 6, 7, and 8 clockwise only moves for column A up to the moment 6, 7, 8 returned, shown below.

keep in mind, 6, 7 and 8 clockwise moves should happen about once every 3.333... draws.

scroll down and discover the missing moves.

Presented 'AS IS' and for Entertainment Purposes Only. Any gain or loss is your responsibility. Use at your own risk.

Order is a Subset of Chaos Knowledge is Beyond Belief Wisdom is Not Censored Douglas Paul Smallish Jehocifer

United States Member #171734 January 11, 2016 127 Posts Offline

Posted: January 18, 2016, 3:21 pm - IP Logged

Quote: Originally posted by JADELottery on January 18, 2016

We'll examine this too.

We ran a different calculation based on each 6, 7, and 8's probability of not occurring for a period of draws up to the moment the set returned and come up with an approximate odds of those happening at about the same draw period as around 1 : 1,329,082.

Share your calculation.

Not sure what "up to the moment the set returned" means. Are you referring to the actual length of the gap in the lottery?

Short gaps are uncommon, in 10,000 runs using sequences of 15,200 numbers the shortest maximum gap was 17, the longest was 50.

While the odds of seeing a gap in 6,7,8 can be computed the reality is if the gap had occurred in 1,2,3 or 2,3,4, ..., or 8,9,10 you also would have jumped up and said "there is a flaw". You probably would have even seen the gap and commented on it if is was 1,2,4 1,3,4 2,3,5 2,4,5 ,, 7, 8,10 7, 9,10

That's at least 7 additional gaps that could have occurred and probably 21. So really you have to ask yourself, what is the probability that a gap could have occurred in ANY of those combinations of "clockwise move" sets.

It's like Powerball, you might see a draw where all the numbers end in 2 and everyone would say "Wow, what are the odds of THAT happening". But people would have had the same reaction if all the numbers ended in 0, 1, 3, 4, 5, 6, 7, 8 or 9 or if all the numbers started with 1 or 2 or if all the white balls had numbers starting with 1 or 2 or 3 or .. 6 or millions of other unusual patterns that taken as an aggregate aren't nearly as rare and in fact probably occur quite frequently.

Let me give a real life example, a few days ago I went to Home Depot with a part from a Lazy Boy chair in my cart, a distinctive piece of wood about 8" x 3". I'm getting some bolts to fit in some holes in it so I needed it to make sure the bolts were right. I'm checking out and the guy behind me says "Hey, you have the same thing I do" and sure enough he has that exact same part he brought in to fix the exact same problem. What are the odds? Probably as rare as winning the Powerball.

But, the same reaction could have taken place if I had any of 100 other things in my cart that I hauled in to get parts for. Or I could have run into an old friend in the boarding line in SFO for a flight to Japan, which also happened a few weeks ago and I'd never even been to Japan before so what are the odds? The reality is there are many, many opportunities each day for something uncommon to happen to us so it shouldn't surprise us when uncommon things happen.

The same is true with your "clockwise moves", you saw your old friend 6,7,8 in the boarding line but you would have been equally amazed if it had been your friend 1,2,3 or 4,5,7 or any of 21 other friends. You also may have been in other boarding lines (maybe counter clockwise moves or looking at samples 2 apart), stand in enough boarding lines in enough cities and you are bound to run into some old friend from time to time.

United States Member #171734 January 11, 2016 127 Posts Offline

Posted: January 18, 2016, 3:26 pm - IP Logged

I'd appreciate you showing your math

Either we are on completely different pages about what we are computing or one of us is computing things incorrectly. I've posted my formula and welcome anyone telling me why it is incorrect or isn't valid for what we are trying to determine.

West Concord, MN United States Member #21 December 7, 2001 3675 Posts Offline

Posted: January 18, 2016, 3:58 pm - IP Logged

Quote: Originally posted by dddwww on January 18, 2016

Share your calculation.

Not sure what "up to the moment the set returned" means. Are you referring to the actual length of the gap in the lottery?

Short gaps are uncommon, in 10,000 runs using sequences of 15,200 numbers the shortest maximum gap was 17, the longest was 50.

While the odds of seeing a gap in 6,7,8 can be computed the reality is if the gap had occurred in 1,2,3 or 2,3,4, ..., or 8,9,10 you also would have jumped up and said "there is a flaw". You probably would have even seen the gap and commented on it if is was 1,2,4 1,3,4 2,3,5 2,4,5 ,, 7, 8,10 7, 9,10

That's at least 7 additional gaps that could have occurred and probably 21. So really you have to ask yourself, what is the probability that a gap could have occurred in ANY of those combinations of "clockwise move" sets.

It's like Powerball, you might see a draw where all the numbers end in 2 and everyone would say "Wow, what are the odds of THAT happening". But people would have had the same reaction if all the numbers ended in 0, 1, 3, 4, 5, 6, 7, 8 or 9 or if all the numbers started with 1 or 2 or if all the white balls had numbers starting with 1 or 2 or 3 or .. 6 or millions of other unusual patterns that taken as an aggregate aren't nearly as rare and in fact probably occur quite frequently.

Let me give a real life example, a few days ago I went to Home Depot with a part from a Lazy Boy chair in my cart, a distinctive piece of wood about 8" x 3". I'm getting some bolts to fit in some holes in it so I needed it to make sure the bolts were right. I'm checking out and the guy behind me says "Hey, you have the same thing I do" and sure enough he has that exact same part he brought in to fix the exact same problem. What are the odds? Probably as rare as winning the Powerball.

But, the same reaction could have taken place if I had any of 100 other things in my cart that I hauled in to get parts for. Or I could have run into an old friend in the boarding line in SFO for a flight to Japan, which also happened a few weeks ago and I'd never even been to Japan before so what are the odds? The reality is there are many, many opportunities each day for something uncommon to happen to us so it shouldn't surprise us when uncommon things happen.

The same is true with your "clockwise moves", you saw your old friend 6,7,8 in the boarding line but you would have been equally amazed if it had been your friend 1,2,3 or 4,5,7 or any of 21 other friends. You also may have been in other boarding lines (maybe counter clockwise moves or looking at samples 2 apart), stand in enough boarding lines in enough cities and you are bound to run into some old friend from time to time.

"Short gaps are uncommon, in 10,000 runs using sequences of 15,200 numbers the shortest maximum gap was 17, the longest was 50."

no, the shortest is 1 and the maximum is unbounded.

Presented 'AS IS' and for Entertainment Purposes Only. Any gain or loss is your responsibility. Use at your own risk.

Order is a Subset of Chaos Knowledge is Beyond Belief Wisdom is Not Censored Douglas Paul Smallish Jehocifer