0
   

Random thoughts about Randomness; the math of random numbers

 
 
Reply Wed 20 May, 2020 03:50 pm
Twenty years ago a group of math nerds found a big flaw in the most popular software used to run the online poker servers at the time. They broke online poker.

At first, the math nerds were looking at the problem of shuffles. The random numbers the computer was using to shuffle the deck of cards would generate one of 4 billion shuffles. The actual number of shuffles in the real world is 52! (which is a 237 digit number).

What they found was worse. They realized they could cut the number of possible shuffles at any given time to about 200,000. Then seeing the 5 cards that were shown to them... they could then with certainty tell you the identity of every other card either face down on the table or still in the deck.

Sadly, these were math nerds rather than thieves. After they wrote a program to cheat at poker, they went to the company and the press. They have a place in history, but as far as I know they didn't earn a dollar.

The problem is that in one sense, these numbers used by this deeply flawed poker software were random. They provided the correct distribution of hands. It you played a million hands, you would be dealt a king or a 4 of diamonds the number of times you would expect. It was a perfectly reasonable game of poker.

It was only when someone who knew how mathematics and computers work went to figure out the underlying patterns did the flaw emerge.
 
maxdancona
 
  1  
Reply Wed 20 May, 2020 03:54 pm
@maxdancona,
This topic is important to everything from banking to Able2know.

When you logged on to Able2know, you typed in your password. Able2know doesn't send around your password (I am pretty sure they don't... that is considered a security flaw). They convert your password into what we call a "cryptographic hash" that is based on a random number. The importance of this random number is that it is something that only you and able2know know, and it changes from day to day so it can't be reused. But then you can go from page to page without having to type in your password more than once.

If I could predict the random number used by Able2know's server for your session... I could pretend to be you.




0 Replies
 
livinglava
 
  -2  
Reply Wed 20 May, 2020 04:27 pm
@maxdancona,
maxdancona wrote:

Twenty years ago a group of math nerds found a big flaw in the most popular software used to run the online poker servers at the time. They broke online poker.

At first, the math nerds were looking at the problem of shuffles. The random numbers the computer was using to shuffle the deck of cards would generate one of 4 billion shuffles. The actual number of shuffles in the real world is 52! (which is a 237 digit number).

What they found was worse. They realized they could cut the number of possible shuffles at any given time to about 200,000. Then seeing the 5 cards that were shown to them... they could then with certainty tell you the identity of every other card either face down on the table or still in the deck.

Sadly, these were math nerds rather than thieves. After they wrote a program to cheat at poker, they went to the company and the press. They have a place in history, but as far as I know they didn't earn a dollar.

The problem is that in one sense, these numbers used by this deeply flawed poker software were random. They provided the correct distribution of hands. It you played a million hands, you would be dealt a king or a 4 of diamonds the number of times you would expect. It was a perfectly reasonable game of poker.

It was only when someone who knew how mathematics and computers work went to figure out the underlying patterns did the flaw emerge.

What is it about randomness you want to discuss, exactly?

You should tag your thread, btw, because it doesn't show up on 'new topics.'
roger
 
  1  
Reply Wed 20 May, 2020 04:41 pm
@livinglava,
It shows on new topics on my system.
livinglava
 
  -1  
Reply Wed 20 May, 2020 04:52 pm
@roger,
roger wrote:

It shows on new topics on my system.

Must be yet another conspiracy.
roger
 
  1  
Reply Wed 20 May, 2020 05:27 pm
@livinglava,
un huh
livinglava
 
  -2  
Reply Wed 20 May, 2020 05:40 pm
@roger,
roger wrote:

un huh

Does the new topics feed differ per user for everyone then?
0 Replies
 
maxdancona
 
  1  
Reply Wed 20 May, 2020 07:31 pm
The inability to predict what comes next is an important property of randomness. Whether you are playing a game, or keeping secrets, or making a simulation of real life.

1. A coin flip that is done fairly (i.e. with no one cheating) is perfectly suitable way to generate a random number. No one is able to predict whether the event will result in "heads" or "tails".

It has been argued that if one could measure the strength and speed of the finger flip, the air pressure, exact temperature, wind velocity and perhaps the location of each air molecule... one could calculate the exact trajectory and spin of the coin and reliably predict the result.

That is an irrelevant argument.. as long as no one present has the ability to make these measurements, the coin flip is random in every meaningful way.

2. Random events don't have to have balanced results. If the coin is heads 51% of the time, and tails 49% of the time, it will still be random. Hopefully everyone has the same information. If one person knows the coin is unbalanced, and the other person doesn't, that makes the game unfair... it is still random.

It is common knowledge that throwing two 6 sided dice and taking the sum favors the number 7 over any other result. This doesn't make the process of throwing dice any less random, in fact casino games are built around this exact process.

I will discuss "distributions" later...
livinglava
 
  1  
Reply Thu 21 May, 2020 07:13 am
@maxdancona,
maxdancona wrote:

That is an irrelevant argument.. as long as no one present has the ability to make these measurements, the coin flip is random in every meaningful way.

"In every meaningful way," is a subjective qualifier. You're implying that there are ways in which it's not meaningful, but those can be ignored even though they exist.

What criteria do you use for deciding what is a "meaningful way," or not?

maxdancona
 
  1  
Reply Thu 21 May, 2020 07:31 am
@livinglava,
I am suggesting that there might be some philosophical ways that the coin flip is not random (or distinguishable from a random event).

I am stating that these differences have no consequence. The coin clips can be treated as random with no difference in the result from any other random event.
livinglava
 
  0  
Reply Thu 21 May, 2020 07:50 am
@maxdancona,
maxdancona wrote:

I am suggesting that there might be some philosophical ways that the coin flip is not random (or distinguishable from a random event).

I am stating that these differences have no consequence. The coin clips can be treated as random with no difference in the result from any other random event.

All you're doing is taking what I said in the previous thread about the physical mechanics of how a coin flips, bounces, and lands and claiming it is less meaningful than the fact it comes out random when you count outcomes and represent them in terms of probability.

You are basically just making a philosophical claim about outcome-statistics being more meaningful than the physical mechanics of how a coin flips, bounces, and lands.

I don't enjoy arguing with you about how important math is or is not. It's your ego trip to turn science and math into objects of worship.

The interesting thing about randomness is not that it appears at the quantitative level, which is obvious; but that it emerges from actual physical events that are in no way random in their cause.

Coins and/or dice are symmetrical and have practically no chance of landing on an edge, so the outcomes are quantized and predictable.

Take something like the bottle-flipping challenge, and you have a similar issue but it's different because there is a way to throw and time the bottle with some water in it to fall and land on its base. It's not random, but it seems just improbable enough to make it impressive when the bottle lands on its base; and yet it can be controlled with practice.

A coin toss is not really that different than a bottle-flip, but the coin spins so fast as it arcs through the air that it becomes practically unpredictable where it will land, and then once it bounces, it only increases the complexity. That is why it comes out random; i.e. not because it is actually random but because the level of complexity is to much for the human mind to control and predict.

You mentioned some computer system that some mathematicians figured out was not random. Every system for generating randomness is ultimately based on physical parameters that aren't random, but it's just not always possible for humans to control the parameters enough to overcome the overall complexity of the system.
0 Replies
 
maxdancona
 
  1  
Reply Thu 21 May, 2020 08:41 am
The idea of "pseudo-random" is important in computer science. This is a sequence of numbers that has all the mathematical properties of a sequence of truly random numbers (including the inability to predict) in almost all cases. I suspect the mathematical ideas behind pseudo-random numbers predates modern computers, but they are now incredibly important.

We use pseudo-random numbers for two reasons.

1) They are much faster to generate than "true" random numbers. On my laptop I can generate hundreds of thousands of high quality pseudo-random numbers every second. "True" random numbers generally require a computer to take a measurement of some kind, and measurements take time.

(Note the quotes around the word "true". They are there to avoid a meaningless philosophical discussion on the meaning of the term "truly random". I don't claim and "true" trueness or true true trueness whatever that would mean.)

2) Psuedo-random numbers are reproducible. Practically you generate a sequence of random numbers by starting with a "seed". A seed is simply a big enough number (they can be hundreds of digits).

Here is I said that "pseudo-random numbers have all the mathematical properties... almost all of the time. You generated your random numbers starting with a seed number. If I have the seed number, I can predict your random numbers. Oops, that seems like a problem... but it is only a problem if I can figure out what seed you are using.

A good pseudo-random number generator has this property... It is impossible for me to calculate the seed you are using even if I know all of the random numbers you are generating in order.

There have been some bad pseudo-random number generators, and they have caused problems. If I know the random numbers you are using to encrypt your messages (i.e. to talk to your bank), then I can either read your secret message (i.e. your bank account balance or information), or I can fake a message to make the bank think I am you.

The current generation of psuedo-random number generators are very well tested by mathematicians and computer scientists. They are considered by the experts to be quite secure.

This is good, because you are using them right now.



maxdancona
 
  1  
Reply Thu 21 May, 2020 08:50 am
@maxdancona,
So why is "reproducibility" a good thing?

Let's say you are a PhD level Epidemiologist building models to predict the spread of the disease.

In order to build a simulation of a viral epidemic, you need to generate lots of random numbers. This is because you are modeling something in the real world; coming into contact with someone who is infected doesn't automatically mean you will be infected, getting infected doesn't mean you will get severely sick. It's just a roll of the dice.

You have some great results of all your scientific work, and you want to publish a paper. First, you need to get a peer review. So you pass your results to your peers (other PhD level epidemiologists) who need to check your work. Your peers want to know how the random numbers came out to reach this result.

So you simply give them your seed number. Then they have the exact sequence of random numbers you generated. They can reproduce your work checking the mathematics at each step.

There is a lot of scientific work that depends on random numbers. Another example is the "randomized sample". If your research requires you ask questions of 1% of a population, you could start at the beginning of the alphabet. This could add bias (you might have Eastern Europeans underrepresented). The best way to do this is to use statistically random numbers.

Again, reproducibility is a benefit. It allows other people to check your work.
livinglava
 
  0  
Reply Thu 21 May, 2020 09:38 am
@maxdancona,
maxdancona wrote:

In order to build a simulation of a viral epidemic, you need to generate lots of random numbers. This is because you are modeling something in the real world; coming into contact with someone who is infected doesn't automatically mean you will be infected, getting infected doesn't mean you will get severely sick. It's just a roll of the dice.

When you are out shopping and people are passing each other and standing 6 feet apart in lines, etc. there is breathing going on. In the air being exhaled, there are pathogens of different varieties, but they spread out through the air. If you are smelling someone's perfume or cigarette residue or body odor or whatever, that is an indication that you are also breathing in pathogens emitted by them, but the load-density you get from them may be so low that your immune system deals with them very easily and you never get sick.

Within every body, there are specific environmental conditions for pathogens to survive and reproduce or die off due to the immune system killing them. Every body is a battle ground between pathogens and the immune system, which is not random but rather governed by numerous interacting conditions within the body.

So when you can't account for the enormous complexities of numerous interacting systems, each with various differences and similarities with regard to other systems, you can just count outcomes and use probability or some other math to apply a simplified model to making loose predictions about future occurrences.

Any model you produce, however, is just that, a model. Math-oriented people talk about the possibility of making a model so complex that it could predict outcomes with exact certaintly, but that is of course a totally impossible hypothesis because the whole issue of representation is that it always translates reality into a simpler form that reflects it in some way but misses it in others.

So a probability model for rolling dice might be able to tell how how often you will roll 'snakeyes' when you roll dice 1,000 times, but that is only modeling the outcome and not the actual causes of the dice landing as they do each time, which would be too complex to model.

First, you shake the dice in your hand or in a cup; either of which is too complex to predict because the shaking action is not uniform. If you constructed a very accurate machine that would always shake the dice in the same way, in the same cup, and thrown them in the same way onto the same surface; you might be able to isolate exact moments in the sequence of events at which randomness was caused, but it would be difficult.

What about a coin-flip, though? Is it possible to build a machine that tosses the coin with such a stable technique that it always lands the same? I would guess yes, especially if the coin lands on a soft surface that prevents it from bouncing. That is because if the coin spins at a known rate and it travels along a known arc whose time-to-landing is exact, then the coin should always flip the exact same number of times before landing, and so it should always land the same way.

Now, if you want to test that prediction, and you find that the outcome is still 50/50 random, then you're going to just say my prediction is 100% wrong because you have reduced what I'm saying to a simple prediction of non-randomness, but the question is then whether you can identify what is causing the outcome to randomize despite the stability of the system to toss the coin. It could be how the coin fits into the throwing 'hand' of the robot tossing it, or something in the mechanisms of the robot, such as the wobble it its joints, or variability in the capacitor that drives the motor, etc. If miniscule variations in the geometry of the tossing mechanism can alter the spin rate or trajectory sufficiently to cause the coin to turn over one more or one less time, then the whole system will generate random outcomes.
maxdancona
 
  1  
Reply Thu 21 May, 2020 10:02 am
@livinglava,
Quote:
So a probability model for rolling dice might be able to tell how how often you will roll 'snakeyes' when you roll dice 1,000 times, but that is only modeling the outcome and not the actual causes of the dice landing as they do each time, which would be too complex to model.

First, you shake the dice in your hand or in a cup; either of which is too complex to predict because the shaking action is not uniform....


Thank you Lava. This is a great jumping off point to the concept of distributions.

A fair dice roll is considered to be random (in any meaningful way). It is random enough that it is used by casinos and accepted by regulators for a "game of chance" called craps. No one can predict what any particular dice roll will be. If they could they could easily take money from the casino (and casinos don't like to lose money).

However you can predict the distribution. I can't tell you what any single dice role will be... but I can tell you that in 100,000,000 rolls, very close to 1 in 36 will be "snake-eyes" (i.e. a one on each of the two dice). I can't tell you the number of snake-eye will be exactly 1 in 36... but I can do the math and tell you that there is a very good chance (almost certain) that the actual number of snake eyes will be between 1 in 36.01 and 1 in 35.99. In fact I can calculate these odds (that are extremely close to 100%) exactly. This is part of the mathematics of error analysis.

Casinos hire mathematicians for exactly this reason. If the number of snake eyes doesn't fit in the expected range over a large number of rolls, that may be a sign of cheating and is something they will want to investigate.
Olivier5
 
  2  
Reply Thu 21 May, 2020 10:22 am
Mark
(nice thread Max)
0 Replies
 
livinglava
 
  1  
Reply Thu 21 May, 2020 11:13 am
@maxdancona,
maxdancona wrote:

Quote:
So a probability model for rolling dice might be able to tell how how often you will roll 'snakeyes' when you roll dice 1,000 times, but that is only modeling the outcome and not the actual causes of the dice landing as they do each time, which would be too complex to model.

First, you shake the dice in your hand or in a cup; either of which is too complex to predict because the shaking action is not uniform....


Thank you Lava. This is a great jumping off point to the concept of distributions.

A fair dice roll is considered to be random (in any meaningful way). It is random enough that it is used by casinos and accepted by regulators for a "game of chance" called craps. No one can predict what any particular dice roll will be. If they could they could easily take money from the casino (and casinos don't like to lose money).

However you can predict the distribution. I can't tell you what any single dice role will be... but I can tell you that in 100,000,000 rolls, very close to 1 in 36 will be "snake-eyes" (i.e. a one on each of the two dice). I can't tell you the number of snake-eye will be exactly 1 in 36... but I can do the math and tell you that there is a very good chance (almost certain) that the actual number of snake eyes will be between 1 in 36.01 and 1 in 35.99. In fact I can calculate these odds (that are extremely close to 100%) exactly. This is part of the mathematics of error analysis.

Casinos hire mathematicians for exactly this reason. If the number of snake eyes doesn't fit in the expected range over a large number of rolls, that may be a sign of cheating and is something they will want to investigate.


You keep doing the same thing, and it irritates me that you invited me to this thread to do so. I bring up the non-random aspects of what causes dice or a coin to land as they do, and you just trump my point by referring back to the math. Then you punctuate your post by saying casinos hire mathematicians, as if to imply that if people get paid to do math but not to describe the truth about what causes dice or coins to land as they do, then that makes the math existentially more important.

Can you just acknowledge that you understand my point, that randomness is something that happens at the level of counts and probability but that is NOT the level at which causation happens? Then I will leave the thread so I don't have to listen to your math-worship and thus denial of underlying reality, which is not countable, at least not in any meaningful sense.
maxdancona
 
  1  
Reply Thu 21 May, 2020 12:23 pm
@livinglava,
(I am thumbing you back up even though I disagree with you. I don't know why anyone is thumbing you down).

I have been pretty clear all along. I have defined the term "meaningful" to mean that you test for it; I can use my mathematical definition distinguish "random" events from non-random events.

I use randomness professionally, it is important for my job. I need to understand what is random and what is not random in a mathematical sense, and I need to know the measurable consequences of this distinction. Concepts that are "meaningful" (i.e. measurable and testable) are useful to me as an engineer and equally useful to statisticians and cryptographers and scientists.

I think you are trying to set up some idea of "underlying reality" as a form of absolute truth. I can't test this "reality". I can't study it. I can't measure it. I can't take advantage of it or use it to make technology or a simulation or win a poker game. I don't see the point.
maxdancona
 
  1  
Reply Thu 21 May, 2020 05:58 pm
There is another use for random numbers that has nothing to do with security.

A few years ago I worked on a telecommunications system. There were dozens of "switchboards" that answered 2 million phone calls a day. The phone calls where then sent to hundreds of processors that were scattered around the world. The system had to survive a "nuclear attack"; we actually used that phrase... although it really just means that if internet goes down in one city, the system keeps working.

The system has to have a way to

1) track the calls through the process.
2) provide a way to divide all of the work among resources so that each process gets the same amount of work (even when different switchboards receive different numbers of calls).

It is a bad idea to have a "serial number" (i.e. number the call 1,2,3... by order received). A serial number requires that a single computer keeps track so that all the other computers can say "what's the next number?". There are some complicated systems where different computers will "reserve" blocks of numbers, but this gets messy especially if you have to survive a "nuclear attack" (which could take out the counting computer).

A common answer is to generate what is called a "globally unique id" (or guid) for each call. Random numbers are useful in that they require no central computer to keep track of the count. Each computer generates its own random numbers. You make the random numbers big enough and "collisions" (where two calls have the same number) are astronomically small.

If you are using these guids to split up the work between resources, you have to make sure that the distribution is even. You can use the right algorithm for this and it works really well. In this case you don't care about how secure your numbers are... you can generate them really quickly.



0 Replies
 
maxdancona
 
  1  
Reply Thu 21 May, 2020 06:36 pm
Quote:
Both presidents were elected to Congress in '46.
Both presidents were elected to the presidency in '60.
"Lincoln" and "Kennedy" each have 7 letters.
Both were particularly concerned with civil rights.
Both married in their 30s to women in their 20s.
Both lost a son while living in the White House.
Both were shot on a Friday.
Both were shot in the head.
Both were shot in the presence of their wives.
Both were assassinated by Southerners.
Both were succeeded by Southerners.
Both successors were named Johnson.
Both successors were born in '08.
Both assassins were known by their three names.
Each assassin's name is composed of fifteen letters.
Booth ran from the theater and was caught in a warehouse; Oswald ran from a warehouse and was caught in a theater.
Booth and Oswald were assassinated before their trials.


Let's take a little detour into Ramsey theory. Everyone has seen lists of coincidences like this. What are the odds that so many coincidences could happen by random? The answer is pretty high... maybe even close to certainty.

Think about the thousands coincidences that didn't happen between Kennedy and Lincoln. They were born on the same day of the month. Their mother's names weren't the same (or even the same length). Abraham and John don't have the same number of letters.

In a large set of random events (or numbers), patterns will emerge... just by random. The brains of human beings are very good at finding patterns. This can cause a problem; once a human being finds a pattern, it is natural to use this pattern to make predictions. But random is still random, and random events can not ever be used to make specific predictions. These predictions are often fantastically bad.

This is one of the reasons that gambling can be so addictive. You pull on a lever, and the wheels spin. It is random any result is equally likely as any other result. But after a while, the brain sees patterns and starts to get a sense that it can predict when the machine will give a winning pattern. These predictions are wrong.. but they urge the player to put more and more money. The casinos make lots of money off of this tendency to see patterns in random events.

There is a interesting area of mathematics called Ramsey theory. Frank Ramsey was studying graph theory and his work showed that if there are enough possible states of a system, certain properties become certain. If you are interested, you should read about the famous dinner party problem

You will sometimes see amazing prophecies (always after the what they were prophesying already happened) that a book and either calculate them mathematically or line up the words in a certain way.

Ramsey theory suggests that you can likely do this with any book of a certain size and make it prophesy any event.

Trying to do this for an event that hasn't happened yet is meaningless.
0 Replies
 
 

 
  1. Forums
  2. » Random thoughts about Randomness; the math of random numbers
Copyright © 2025 MadLab, LLC :: Terms of Service :: Privacy Policy :: Page generated in 0.04 seconds on 04/18/2025 at 07:48:01