1 / 22

CSC 110 – Fluency in Information Technology Chapter 20: The random function and Chaos

CSC 110 – Fluency in Information Technology Chapter 20: The random function and Chaos. Dr. Curry Guinn. Today’s Class. Random Number Generation Randomness and Chaos Theory. Math.random(). A common operation we want to perform with computers is to generate a random number We use this for

Télécharger la présentation

CSC 110 – Fluency in Information Technology Chapter 20: The random function and Chaos

An Image/Link below is provided (as is) to download presentation Download Policy: Content on the Website is provided to you AS IS for your information and personal use and may not be sold / licensed / shared on other websites without getting consent from its author. Content is provided to you AS IS for your information and personal use only. Download presentation by click this link. While downloading, if for some reason you are not able to download a presentation, the publisher may have deleted the file from their server. During download, if you can't get a presentation, the file might be deleted by the publisher.

E N D

Presentation Transcript


  1. CSC 110 – Fluency in Information TechnologyChapter 20: The random functionand Chaos Dr. Curry Guinn

  2. Today’s Class • Random Number Generation • Randomness and Chaos Theory

  3. Math.random() • A common operation we want to perform with computers is to generate a random number • We use this for • Games (random shuffle, random throw of dice) • Running simulations • Having our programs (like games) behave in ways we haven’t seen before • HiLo.java

  4. How can a deterministic machine generate a random number? • Remember: Computers are deterministic • Given the same instructions, they perform the same thing every time • So what’s random? • Random numbers are generated using a pseudo-random number generator (PNG). • The numbers aren’t really random but the sequence is so complex, humans can’t see the patterns. random_seed = random_seed * 1103515245 +12345; random_number = (random_seed / 65536) % 32768 Random.htm

  5. Seeding a pseudo-random number generator • The PNGs that computers use will generate the exact same “random” series of numbers given the same initial input (called the seed) • Some common seeds that computers use • Number of seconds since 1900 • Number of milliseconds since the machine was booted • Scientist often control the seed so they can run exactly the same “random” experiment again

  6. Case Study: Online Poker Room • The Link: http://www.cigital.com/papers/download/developer_gambling.pdf • The Setting • 1999 • PlanetPoker internet card room • Texas Hold’Em • PlanetPoker published their random shuffling algorithm to demonstrate their integrity • Common practice among internet card rooms

  7. How many possible shuffles in Poker? • There are 52 cards so … • 52 possibilities for the top card • 51 possibilities for the 2nd card • 50 possibilities for the 3rd card • … • 52*51*50*…*2*1 = 52! • 2^226 … a really, really big number • Approximately 10^68

  8. PlanetPoker’s PNG • Randomize() uses the number of milliseconds since midnight • There are only 86,400,000 milliseconds in a day • Therefore, they can only generate 86,400,000 possible shuffles (much less than 10^68) • Further, by synchronizing with their clock, you can get very close to guessing their time

  9. Texas Hold’Em • In Texas Hold’Em, each player gets two down cards and then all the players will share five up cards • After an initial round of betting, where the players only see their hole cards, the first 3 shared cards are turned face up (called the flop)

  10. At the time of the flop • At the flop, a player knows a sequence of 5 cards in the shuffle. • What is the likelihood of seeing those 5 cards in a shuffle? 52*51*50*49*48 • 1 in 311,875,200 • These odds are such that we can find the “random” shuffle out of the set of 86,000,000 possible decks • Once we find it, we know the all the cards dealt (and to be dealt) • (Further, we also know what seed they used for that shuffle making it easier to synchronize our clocks)

  11. What Poker Rooms Do Now • Seed is modified by • User input: mouse movements, timing events • True hardware random number generators (Intel’s for instance uses thermal “noise”) • Other hardware solutions: quantum mechanics • PokerStars

  12. What is Chaos Theory? • Traditional notion of chaos – unorganized, disorderly, random etc. • But Chaos Theory has little to do with that traditional notion • On the contrary, it actually tells you that not all that ‘chaos’ you see is due to chance, or random or caused by unknown factors • Oxymoron term coined “Deterministic Randomness” • Chaos Theory – It’s about the deterministic factors (non-linear relationships) that cause things to look random

  13. A Simple Equation • Xt = Xt-12 + c • Chaos.zip • If c = -1.1

  14. C = -1.9

  15. Chaotic Systems are Extremely Vulnerable to Initial Conditions • The Butterfly Effect

  16. Initial Conditions X(t0), Y(t0), Z(t0)... Clockwork Universe determimistic non-chaotic Can compute all future X(t), Y(t), Z(t)... Equations

  17. Initial Conditions X(t0), Y(t0), Z(t0)... Chaotic Universe determimistic chaotic sensitivity to initial conditions Can not compute all future X(t), Y(t), Z(t)... Equations

  18. Why Should You Care? • Any complex process is vulnerable to chaotic behavior • Weather • Financial systems • Economic theory • Stock market • Population models • Physics • Biology • Chemistry

More Related