Random Number Generation

Slides:



Advertisements
Similar presentations
RSLAB-NTU Lab for Remote Sensing Hydrology and Spatial Modeling 1 An Introduction to R Pseudo Random Number Generation (PRNG) Prof. Ke-Sheng Cheng Dept.
Advertisements

Generating Random Numbers
Random Number Generation Graham Netherton Logan Stelly.
Random variables 1. Note  there is no chapter in the textbook that corresponds to this topic 2.
Random Numbers. Two Types of Random Numbers 1.True random numbers: True random numbers are generated in non- deterministic ways. They are not predictable.
Random number generation Algorithms and Transforms to Univariate Distributions.
Random Number Generators. Why do we need random variables? random components in simulation → need for a method which generates numbers that are random.
Stream cipher diagram + + Recall: One-time pad in Chap. 2.
Random Numbers Dick Steflik. Pseudo Random Numbers In most cases we do not want truly random numbers –most applications need the idea of repeatability.
Pseudorandom Number Generators
Pseudorandom Bit Generation Artur Gadomski Piero Giammarino Henrik Goldman Massimo Giulio Caterino.
1 Random numbers Random  completely unpredictable. No way to determine in advance what value will be chosen from a set of equally probable elements. Impossible.
Using Random Numbers in CUDA ITCS 4/5145 Parallel Programming Spring 2012, April 12a, 2012.
Random numbers in Python Nobody knows what’s next...
Random Thoughts 2012 (COMP 066) Jan-Michael Frahm Jared Heinly.
15-853Page :Algorithms in the Real World Generating Random and Pseudorandom Numbers.
Pseudorandom Number Generators. Randomness and Security Many cryptographic protocols require the parties to generate random numbers. All the hashing algorithms.
Section 5.1 What is Probability? 5.1 / 1. Probability Probability is a numerical measurement of likelihood of an event. The probability of any event is.
1 CS 162 Introduction to Computer Science Chapter 5 ASCII to Integer Conversion Herbert G. Mayer, PSU Status 11/9/2014.
MATH 224 – Discrete Mathematics
Random Numbers CSE 331 Section 2 James Daly. Randomness Most algorithms we’ve talked about have been deterministic The same inputs always give the same.
Input & Output: Console
The Shrinking Rule 30 Cellular Automata Pseudorandom Number Generator University of the Philippines Cebu Department of Computer Science Cmsc142, Cmsc190,
CS 521 Computational Science 1 Random Numbers and Monte Carlo Methods Charles Erwin and Jay Hatcher.
Random Number Generators 1. Random number generation is a method of producing a sequence of numbers that lack any discernible pattern. Random Number Generators.
Pseudo-random generators Random Number Generating There are three types of generators table look-up generators hardware generators algorithmic (software)
Experimental Method and Data Process: “Monte Carlo Method” Presentation # 1 Nafisa Tasneem CHEP,KNU
Data & Data Types & Simple Math Operation 1 Data and Data Type Standard I/O Simple Math operation.
Chapter 7 – Confidentiality Using Symmetric Encryption.
Chapter 7 Confidentiality Using Symmetric Encryption.
CS221 Random Numbers. Random numbers are often very important in programming Suppose you are writing a program to play the game of roulette The numbers.
Random Number Generator. Random number Random number: Uniform distribution on [0,1] Random device: dice, coin -> cannot generate the equal sequence.
Network Security Lecture 18 Presented by: Dr. Munam Ali Shah.
PRNGs Pseudo-random number generation. Randomness and Cryptography Randomness and pseudo-randomness are useful in cryptography: –To generate random and.
Pseudo Randomness (in digital system) PRESENTED BY GROUP 8 SHU-YU HUANG, FONG-JHENG LIN
Random numbers in C++ Nobody knows what’s next....
CHAPTER 5 Simulation Modeling. Introduction In many situations a modeler is unable to construct an analytic (symbolic) model adequately explaining the.
Random Numbers RANDOM VS PSEUDO RANDOM. Truly Random numbers  From Wolfram: “A random number is a number chosen as if by chance from some specified distribution.
Chapter 7 – Confidentiality Using Symmetric Encryption.
1 Generating Random Numbers Textbook ch.6, pg
MR. CRONE Generating Random Numbers. Random Numbers Many programs require the computer to generate random numbers Random numbers are used in many applications.
1.  How does the computer generate observations from various distributions specified after input analysis?  There are two main components to the generation.
Key Wrap Algorithm.
RANDOM NUMBER GENERATORS MATH CLUB 12/06/2010. WHAT ARE RANDOM NUMBERS? 1, 3, 5, 7, 9, 11, …? 3, 7, 0, 7, 7, 4, 1, 5, 6, 1, 7, 8, 5 …? 44, 22, 16, 33,
Invitation to Computer Science, C++ Version, Fourth Edition
The Divisibility & Modular Arithmetic: Selected Exercises
Issues of Random Numbers and Cryptography
Why they aren't really random
PV204 Security technologies
3. Random Number Generator
Hatice Kübra Eryılmaz CMPE220/Fall
Generating Random Numbers
Random Numbers Until now, all programs have behaved deterministically - completely predictable and repeatable based on input values Some applications.
Random Number Generators
A cryptographically secure pseudorandom number generator for Julia
Random numbers Taken from notes by Dr. Neil Moore
ECE 434 Advanced Digital System L13
Procedural Terrain Generation
Random-Number Generation
Pseudo-random numbers
Random vs pseudo random
Cryptography and Network Security Chapter 7
CS150 Introduction to Computer Science 1
Pseudorandom number, Universal Hashing, Chaining and Linear-Probing
Engineering Problem Solving with C++ An Object Based Approach
Computer Simulation Techniques Generating Pseudo-Random Numbers
Module 14 Miscellaneous Topics
Generating Random and Pseudorandom Numbers
Generating Random and Pseudorandom Numbers
Pseudorandom Numbers Network Security.
Presentation transcript:

Random Number Generation Paul Downing and Tyler Sullivan

What is an RNG? Random Number Generators are devices - algorithmic or otherwise - used to generate random integers, and then use them in some function or another. Two types: True and Pseudo Pseudorandom is the more commonly used of the two True is more random, but more time costly

PRNG #1: Middle Squares This algorithm follows a three-step process. Take in a seed. Square the seed. Take the center three numerals from that Concatenate onto a numeral string. Square the squared numeral. Repeat steps 3-5 until your numeral string is long enough for you.

Middle Squares Example Seed: 123 512 886 15129 123 228886641 And so on...

Implementation of Middle Squares for (int i = 0; i < samplesToProduce; ++i) { //select the middle three digits for the next seed //the seed has been selected newseed = (x / 1000) % 1000000; storageArray[i] = newseed; //The sequence will almost always go to zero, so an improvement //to the algorithm would be reseeding with the time as seen below. /* if (newseed < threshHold){ newseed = time(NULL); } */ x = newseed * newseed; }

PRNG #2: Blum Blum Shub Most Hilarious Name for a PRNG Award 2014 M is an integer made of two multiplied large primes M = pq p and q need to be congruent to 3 % 4 VERY SLOW, not technically useful in computer science Difficult to decrypt back to the seed and p or q, with high numbers

Example of Blum Blum Shub p= 11, q = 19, seed = 3 The sequence “begins” at item -1, which is equal to the seed, but goes unlisted. Each term in the sequence is the previous term squared mod M 9, 81, 82, 36, 42, 92, 104...

PRNG #3: Linear Congruential Generator X is the term in the sequence a is a multiplier on that term, 0<a<m c is an incrementer, 0<c<m m is the modulus. Starting from a seed, this generates a pseudorandom number sequence. Example: Seed = 5, a = 8, c = 3, m = 16 11, 0, 3, 11… Not that good of an algorithm, forms sequences very easily with small numbers

Implementation of LCG (C++) class mRND { public: void seed( unsigned int s ) { _seed = s; } protected: mRND() : _seed( 0 ), _a( 0 ), _c( 0 ), _m( 2147483648 ) {} int rnd() { return( _seed = ( _a * _seed + _c ) % _m ); } int _a, _c; unsigned int _m, _seed; };

Implementation of LCG (C++) class BSD_RND : public mRND { public: BSD_RND() { _a = 1103515245; _c = 12345; } int rnd() { return mRND::rnd(); } }; int main( int argc, char* argv[] ) { BSD_RND bsd_rnd; cout << endl << "BSD RAND:" << endl << "=========" << endl; for( int x = 0; x < 10; x++ ) cout << bsd_rnd.rnd() << endl; cout << endl << endl; system( "pause" ); return 0; }

C++ Output BSD RAND: ========= 12345 1406932606 654583775 1449466924 229283573 1109335178 1051550459 1293799192 794471793 551188310

TRNG True Random Number Generators RANDOM.ORG Hardware-based TRNG Quantum RNG

RANDOM.ORG Website simulates truly random real-world events Dice rolls Card drawing Coin flips Normal, integer-creating TRNGs can be found on the site, as well.

How does that work? To quote the website, “atmospheric noise” is processed as commands are input. This noise is obtained through radio receivers, in several places across the world The website has actually been rated by several organizations very highly in the quality of its randomness.

Hardware Based TRNG More general description of what RANDOM.ORG does Uses physical random phenomena to create random numbers. Physical -> Transducer -> Amplifier -> Analog to Digital -> Number

Thermal Noise HBTRNG An electric resistor makes random noise through thermal agitation This noise is then amplified by some method The amplified stream of noise is converted into binary strings These binary strings are then easily converted to integers

A simple TNHBTRNG

Quantum TRNG Nuclear Decay can be used as a randomness source The decay of nuclear things is considered extremely random Until a literally unreachable cold temperature. (0 K)

Nuclear Decay -> Numbers The decay of a nuclear substance is measured by a Geiger counter Geiger counter data is sent to a computer The time interval between decay instances is measured This is used to create a 0 or 1 bit A string of binary is then easily converted into a random number.

Thanks for listening!

Works Cited “How Machines Generate Random Numbers With Time www.youtube.com/watch?v=Ac4Z1VMsE3E http://www1.i2r.a-star.edu.sg/~knandakumar/nrg/Tms/Probability/Probgenerator.htm Rosetta Code’s C++ example on LCGs. http://rosettacode.org/wiki/Linear_congruential_generator#C.2B.2B random.org f https://www.fourmilab.ch/hotbits/