Download presentation

Presentation is loading. Please wait.

Published bySullivan Went Modified over 2 years ago

1
Random Number Generation Graham Netherton Logan Stelly

2
What is RNG? RNG = Random Number Generation Random Number Generators simulate random outputs, such as dice rolls or coin tosses

3
Traits of random numbers Random numbers should have a uniform distribution across a range of values o Every result should be equally possible Each random number in a set should be statistically independent of the others

4
Why are random numbers useful? Random numbers are useful for a variety of purposes, such as Generating data encryption keys Simulating and modeling Selecting random samples from large data sets Gambling Video games

5
Algorithms in RNG Computers can’t be truly random Rely on inputs Algorithms can mask inputs and make outputs seem random

6
Pseudo-Random Number Generators Called PRNGs for short The numbers produced are not truly random Use algorithms to produce a sequence of numbers which appear random Efficient: fast Deterministic: a given sequence of numbers can be reproduced if the starting values are known Periodic: the sequence will eventually repeat

7
How PRNG Works Uses a “seed” to determine values and a function to interpret the seed The same seed always generates the same values in the same order o Deterministic Flaw: If the seed and function are known, results can be predicted

8
Seeds in Action Say we have a seed x and a PRNG function f: f(x) = y, for all x ∈ {x} It’s clear that this always generates the same number PRNG functions may base the seed on a changing value, e.g. the computer clock

9
Linear Congruential Generator X n+1 = (aX n + c) mod m modulus m, 0 < m multiplier a, 0 < a < m increment c, 0 < c < m seed value X 0, 0 < X 0 < m Used by java.util.Random, among others

10
PRNG in Cryptography PRNG can be used to encrypt/decrypt data Pro: Unique encryption can be performed each time Con: If both the seed and random function are known, third parties can intercept/interfere with messages

11
Examples of PRNG applications Simulation and Modeling applications o it is useful that the same sequence of numbers can be generated so simulations can be recreated with only one aspect modified each time Video Games o it is useful that the numbers can be generated very quickly and it is not as important that the data be truly random o Diablo 1 Speedruns

12
Chi-Square Test A method often used to compare the randomness of random number generators Involves producing sequences of 1000 random integers between 1 and 100 For a perfectly random distribution one would expect to have 10 occurrences of each integer (1-100), so the expected frequency is 10 The actual frequency for the generator is then calculated and the difference between the two can be used calculate the chi- square value A value of 100 indicates uniform distribution

13
Chi-Square Test Formula: o R = possible number of different random integers o O = observed frequency of integer i o E = expected Frequency of integer i Can be reduced to:

14
A Comparison of Four PRNGs 1.WICHMANN AND HILL o Combines 3 linear congruential generators with c = 0 2.MITCHELL AND MOORE o Generates numbers based on the last 55 numbers 3.MARSAGLIA o Uses the last 2 numbers to generate the next; long period 4.L’ECUYER o Combines 2 linear congruential generators with c = 0

15
Results for Chi-Square

16
Timing Results

17
Periods For a small (personal) computer: Marsaglia has been used on supercomputers (ETA Supercomputer) and has a period long enough for use in supercomputer applications

18
True RNG There are ways to get around the predictability of PRNG These involve generating the numbers outside of the computer o Usually use special equipment Significantly slower than PRNG o Limit to how fast numbers can be “harvested”

19
Traits of True RNG Inefficient: slow - must “harvest” numbers Non-deterministic: numbers cannot be predicted by knowing certain values Aperiodic: sequence of numbers does not repeat after a certain amount of time

20
Examples of True RNG random.org: uses space noise to generate unpredictable random numbers HotBits: times radioactive decay and reports back random numbers based on it

21
TRNG Applications Lotteries and Draws Gambling Security Some applications which require true randomness substitute pseudo randomness, occasionally to disastrous results

22
PRNG Failures PHP for Microsoft Windows o study conducted by Bo Allen in 2008 to test randomness of the rand() function in PHP on Microsoft Windows o Same issue not found on Linux rand() function on windows: true RNG:

23
PRNG Failures Cracking the lottery o Mohan Srivastava Geological Statistician In 2003 he cracked the number generation pattern on tic-tac-toe scratch off games Could predict winning tickets correctly with 95% accuracy Also able to break super bingo scratch off game and predict winners with 70% accuracy Reported findings to Ontario Lottery and Gaming Corporation

24
PRNG Failures o Joan Ginther Math professor with PhD from Stanford University Won lottery scratchcard jackpots four times Total winnings total more than $20 million Does not admit to breaking code

25
References Allen, B. (2012, February 26). Pseudo-Random vs. True Random.. Retrieved April 26, 2014, from http://boallen.com/random-numbers.html Graham, W. (). A Comparison of Four Pseudo Random Number Generators. ACM SIGSIM Simulation Digest, 22, 3-18. Haahr, M. (n.d.). Introduction to Randomness and Random Numbers. Random.org. Retrieved April 26, 2014, from https://www.random.org/randomness Lanyado, B. (2011, August 10). Want to win millions on scratchcards?. The Guardian. Retrieved April 26, 2014, from http://www.theguardian.com/science/2011/aug/10/win-millions-on- scratchcards Midgley, J. (2011, January 31). Cracking the Scratch Lottery Code. Wired. Retrieved April 26, 2014, from http://www.wired.com/2011/01/ff_lottery/all/

26
The End

Similar presentations

OK

Random Thoughts 2012 (COMP 066) Jan-Michael Frahm Jared Heinly.

Random Thoughts 2012 (COMP 066) Jan-Michael Frahm Jared Heinly.

© 2017 SlidePlayer.com Inc.

All rights reserved.

Ads by Google

Ppt on history of england Ppt on cross-sectional study design Ppt on panel discussion Ppt on ca student life Ppt on network security in ieee format Ppt on political parties and electoral process united Ppt on creativity and innovation management concept Jit ppt on manufacturing jobs Download ppt on transportation in human beings the largest Ppt on barack obama leadership ability