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,

Slides:



Advertisements
Similar presentations
Code It. What do all of the following pictures have in common?
Advertisements

Linear-time Median Def: Median of elements A=a 1, a 2, …, a n is the (n/2)-th smallest element in A. How to find median? sort the elements, output the.
Random Number Generation Graham Netherton Logan Stelly.
CSCE Monte Carlo Methods When you can’t do the math, simulate the process with random numbers Numerical integration to get areas/volumes Particle.
Round each number to the level of accuracy given.
1 Data types, operations, and expressions Continued l Overview l Assignment statement l Increment and Decrement operators l Short hand operators l The.
1 Building Java Programs Chapter 5 Lecture 5-2: Random Numbers reading: 5.1, 5.6.
Random Number Generators CISC/QCSE 810. What is random? Flip 10 coins: how many do you expect will be heads? Measure 100 people: how are their heights.
Who Wants To Be A Millionaire?
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.
MATH AND RANDOM CLASSES.  The need for random numbers occurs frequently when writing software.  The Random class, which is part of the java.util class,

Iterative Constructs Review l What are named constants? Why are they needed? l What is a block? What is special about declaring a variable inside a block?
Monte Carlo Methods.
Mental Math Rounding Numbers to the Nearest Hundred and Thousand.
1 Week 2: Variables and Assignment Statements READING: 1.4 – 1.6 EECS Introduction to Computing for the Physical Sciences.
Simulation is the process of studying the behavior of a real system by using a model that replicates the behavior of the system under different scenarios.
Week 6 - Monday.  What did we talk about last time?  Exam 1!  Before that:  Recursion.
1 Building Java Programs Chapter 5 Lecture 5-2: Random Numbers reading: 5.1, 5.6.
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.
Math 10: Basic Mathematics 1 Important Topics from Math 10 Chapter 1 Whole Numbers Write a word name for a number Add, subtract, multiply and divide whole.
Computer Science: A Structured Programming Approach Using C1 4-5 Standard Functions C provides a rich collection of standard functions whose definitions.
Rounding up – and down! Mental Mathematics Starters Activity 3b.
Random numbers in C++ Nobody knows what’s next....
Rounding up – and down! Mental Mathematics Starters Activity 3a.
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.
Unit 2 Modular Arithmetic and Cryptography IT Disicipline ITD1111 Discrete Mathematics & Statistics STDTLP 1 Unit 2 Modular Arithmetic and Cryptography.
5 Minute Math In which place is the 4 in each of the following: 140,399 48, ,394 Write 2 equivalent fractions for each of the following:
December 9, Bell Work 2. Definition of the Greatest Integer Function 3. Work on Study Guide.
1 Generating Random Numbers Textbook ch.6, pg
Module 9.2 Simulations. Computer simulation Having computer program imitate reality, in order to study situations and make decisions Applications?
1 Building Java Programs Chapter 5 Lecture 11: Random Numbers reading: 5.1, 5.6.
L131 Assignment Operators Topics Increment and Decrement Operators Assignment Operators Debugging Tips rand( ) math library functions Reading Sections.
2.3 Output Formatting. Outputting Format Specify the number of spaces, “c”, used to print an integer value with specifier %cd, e.g., %3d, %4d. E.g. printf.
Copyright © 2013 Pearson Education, Inc. Publishing as Pearson Addison-Wesley Starting Out with Programming Logic & Design Third Edition by Tony Gaddis.
CSCI/CMPE 4341 Topic: Programming in Python Chapter 5: Functions – Exercises Xiang Lian The University of Texas – Pan American Edinburg, TX 78539
Math symbols Rounding 2 digit numbers to the nearest tens Rounding 3 digit numbers to the nearest tens Rounding 3 digit numbers to the nearest hundreds.
Math class Random() method Floor method Top-level parseInt function
Rounding Numbers to the Nearest Hundred
Rounding Extra practice.
Chapter 5 The if Statement
Building Java Programs
Building Java Programs
Iterative Constructs Review

HI !.
Random numbers Taken from notes by Dr. Neil Moore
Arithmetic Operator Operation Example + addition x + y
CS005 Introduction to Programming
BCD = Binary Coded Decimal
Random Number Generation
Procedural Terrain Generation
Random vs pseudo random
CS 475/575 Slide set 4 M. Overstreet Old Dominion University
Enhancing of chaum mixes with random probabilistic functions
Variables and Data Types
Topics discussed in this section:
MYP 4 Mathematics L.O. All pupils have completed and will hand in their holiday work All pupils are aware of the structure of this year’s Maths course.
Building Java Programs
Random Data ICS2O.
Last Class We Covered What makes “good code” good Top down design
Random number generators
Mathematical Task 4.1A.
Rounded Off Values Upper and Lower Bounds.
Rounding off (Outcome).
General Mathematics CST #2
Php – Math functions.
Generating Random and Pseudorandom Numbers
Building Java Programs
Generating Random and Pseudorandom Numbers
Presentation transcript:

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, 67, 29, 68, 38, 49, 89, …? 4, 4, 4, 4, 4, 4, 4, 4, …?

HOW DO WE GENERATE RANDOM NUMBERS? Simple. Hook up a computer to a radio that detects atmospheric noise and converts them into numbers.

WELL WITHOUT A RADIO… You can’t. But on the other hand, there’s pseudorandom number generators…

JASON GIN’S FAULTY DICEROLL RNG x = rand() y = rand() r = x * y * 100 return round(r) rand() gives a random real from 0 to 1, and round() rounds a real to the nearest integer. Jason is getting the number 100 less frequently than he should. What is wrong with his code?

MATHEMATICAL ANALYSIS OF JASON’S RNG

PARK-MILLER RNG

RANDU Above: 100,000 supposedly ‘random’ points What went wrong?

MATHEMATICAL ANALYSIS OF RANDU

LINEAR CONGRUENTIAL RNG

WHAT ABOUT X_0?

FOR THE MASTER NUMBER-THEORIST