Topics in Computer Mathematics
|
|
- Dina Hampton
- 5 years ago
- Views:
Transcription
1 Random Number Generation (Uniform random numbers) Introduction We frequently need some way to generate numbers that are random (by some criteria), especially in computer science. Simulations of natural phenomena, for instance, may require that events occur at unknown (i.e. random) points in time. Clearly game programmers need to program events that occur randomly, or simulate dealing cards, throwing dice, or flipping coins. In an ideal situation, a sequence of random numbers are totally independent of each other. In a computer there are ways of generating such numbers, most of which require sensing some real world phenomena and converting to a number. For example, if the computer has a clock in it which is being incremented at a high rate of speed (say every microsecond), then one could extract some number of low order bits from the clock, perhaps massage them in some way, such as by hashing, and use the result as the required random number. If one is writing a computer program, however, the debugging process requires that we be able to reliably repeat exactly any given situation in order to make sure the program behaves correctly. Therefore, we want to be able to produce sequences of numbers which are random, but reproducible. Such sequences are generated using a function which generates the next number in the sequence by applying some mathematical manipulation to the previous number, or even several previously generated numbers. E. g. X n = f(x n-1 ) Such sequences can never be truly random, but may be statistically random enough to suit any given application. Numbers generated in this way are known as pseudo-random numbers or pseudo-random sequences. John Von Neumann produced one of the earliest such functions, known as the Middle Square Method : Given an n-digit number, square it and take the middle n digits of the result to get the next random number. In general, multiplying two numbers together can give a result which has a number of digits which is the sum of the number of digits of the multiplier and the multiplicand. So, squaring an n-digit number can produce a 2n-digit result. Unfortunately, this algorithm doesn t produce very good sequences, especially when the results start to have leading zeros - the sequence will end up generating NTC 4/24/05 185
2 only zeros. For instance, starting with the two digit number, 43, 43 2 = 1849 => = 7056 => = 0025 => = 0004 => 00 and only 00s will be generated thereafter Most High Level Computer Languages (HLL) provide a built in function (such as RND()) which produces random (i.e. pseudo-random) numbers. In the most general cases, these functions produce a fraction in the range 0 to 1. Of course not all fractions are possible, but the number that are produced is very large and can give a very good approximation to uniform random numbers. (A random number sequence is uniform if they are chosen from a set of numbers which have uniform probability distribution; that is, if there are a total of n possible numbers to be chosen randomly, then the k th number has probability 1/n of being a specific number, regardless of the previous values of the k-1 numbers already chosen). Of course, we rarely need fractions between 0 and 1. Suppose we want to simulate throwing a single die. Then we really want to get numbers between 1 and 6, inclusive. We do this by scaling and using some function such as INT() which extracts the integer portion of a real number. Suppose we let X = RND(0), which is a fraction (real number) between 0 and 1. Then 5X is a real number between 0 and 5. 5X+1 is then a real number between 1 and 6, and we need to use another function, INT() to extract the integer portion of these real numbers. So, we end up with Die Value = INT(1+5RND()) But how do we get the random numbers between 0 and 1 to begin with? We will find a function that produces integers between 0 and m, and divide by m. So, if X is a random integer between 0 and m, U = X/m is a random real number between 0 and 1. Linear Congruence Method The most well-known method for generating statistically random numbers is the Linear Congruence Method. In the simplest form of this method, the n th number in the sequence is generated from the n-1 st number by the formula X n = (ax n-1 + c) mod m, n0 [R1] where NTC 4/24/05 186
3 X 0 is the initial value used to start the sequence (called the seed) a is a multiplier c is an increment, and m is a modulus X 0, a, and c are all 0; m is > X 0, a, and c. This function can yield very good random sequences provided X 0, a, c, and m are chosen correctly. E.g. choose X 0 = a = c = 7, m=10. Then the sequence is 7, 6, 9, 0 7, 6, 9, 0. Since m is 10, we know that there are 10 possible numbers (0 through 9) which can be generated, yet this choice of parameters only produced four of them. Note also that the method has produced a loop. This method will always produce a loop - our goal should be to maximize the length (known as the period) of the sequence before it starts to repeat. For any m (10 in this example) we should expect to get, ideally, all m numbers (0 through m-1), in random order, before the loop repeats. Why is this called a pseudo-random sequence rather than just a random sequence? Note that a true random number has no memory. That is, the value the random number takes on at any point in time is independent of any and all previous values that may have been generated. For instance, suppose we use a coin to generate the numbers 0 and 1 randomly (heads=0, tails=1). On the average we expect to get about 50% 0's and 50% 1's, since on any given flip the chance of a 0 or 1 is ½. Let s suppose that we get the following sequence after flipping the coin 10 times: 1, 1, 1, 1, 1, 1, 1, 1, 1, 1 What will the value be on the eleventh flip? There is a psychological tendency to think that, since we have had such a long string of 1's, that it must be time for a 0 to show up, and so a 0 must have a much greater probability of occurring than a 1 on the next flip (this kind of thinking is the downfall of many gamblers). But the coin is a pure random number generator with no memory of what has gone before. The probability of a 0 or 1 on the eleventh flip is still ½, regardless of previous history. This is not the case for the linear congruence method; once a number has been generated it will not be generated again until the entire sequence of possible numbers has been generated. Thus, the sequence NTC 4/24/05 187
4 7, 6, 9, 9, 0, 6, 7, 0, 0 could never be generated even though it may be perfectly random. For this reason numbers generated by the linear congruence method are not used without further modification. Usually this takes the form of some form of hash function to produce a more random sequence. For example, suppose I need a random sequence of two-digit numbers. Then I might use the LCM to generate a sequence of 5 digit numbers, and extract two of the five digits for my actual random numbers. (Note that extracting the least significant digits is accomplished by a modulo operation with a modulus of 100.) The parameters for the linear congruence method can all be chosen to maximize the sequence as well as the randomness of the sequence of the numbers. e. The parameter c affects the length, and in general should be non-zero. However, in the above example, if c= 0 instead of 7, the sequence becomes Note that the period is still only four, although it took a while to settle into the loop. f. The parameter a must be chosen to be greater than 2. If a=0, there is no dependence on X n-1 ( c will be the only number generated) and if a=1, X n = (X 0 +nc) mod m which is dependent only on X 0, not X n-1. This gives the sequence While this is certainly the maximum period, it would fail statistical tests for randomness (can you see why?). g. The parameter m is chosen to tread a fine line between maximizing the randomness of the number sequence, and speed of computation. That is, m should be large, but computation of (ax n-1 +c) mod m must be fast. One way (and the most common) is to let m be related to the word size, w, of the computer. Then arithmetic modulo 2 w is simply take the part of the operation which remains in the low order w bits of the answer. Better results are achieved if we use 2 w ± 1. Can we guarantee that a period of length m, the maximum, is possible? Yes, if and only if a. c is relatively prime to m b. a-1 is a multiple of p, for every p dividing m (where p is a prime) c. a-1 is a multiple of 4 if m is a multiple of 4. NTC 4/24/05 188
5 The conditions on a are satisfied if a = 2 k +1, (2 < k < w), and c=1. Then [R1] becomes X n = ((2 k +1)X n-1 +1) mod 2 w [R2] Implementation avoids multiplication - we can just use shifts and adds. Unfortunately, multipliers of the form a = 2 k +1 do not give very good randomness, at least for small word sizes (say <47). Better results are obtained with something like a = 2 k1 + 2 k2 +2 k3 +1 Much better results can be achieved by choosing m to be prime. Then X n = (a 1 X n a k X n-k ) mod p [R3] will have period of length p k -1. The constants a i must be chosen so that x k - a 1 x k a k is a primitive polynomial - it has a root which is a primitive element of the field with p k elements. Finding the a i are not easy. Summary for building Linear Congruence Generators (Knuth) 1. X 0 is chosen arbitrarily, perhaps to the current date and time. 2. m should be large. For computer hardware generation of Random Numbers m = 2 w where w is the computers word size. This trivializes modulo arithmetic. 3. a is chosen such that, if m is a power of two, (as above) then a mod 8 =5. 4. Also, we should choose a such that m < a < m-m. 5. If m is a power of 2, c should be odd. Ideally, c/m ½ - (3)/6. 6. Use the high order bits of X; i. e. the most significant digits of X/m. Testing for Randomness Before a random number generator can be approved for use in some application, it should be tested to be sure that the numbers it produces are in fact random. In fact, there are many tests, and several of them need to be used before a generator can be certified usable. We will discuss just one of the tests here, the NTC 4/24/05 189
6 Chi-square test. This test can be used when the RNG is to be used to generate results in some finite number, k, of categories. For instance, if we are going to use the RNG to simulate rolls of dice, the possible outcomes (categories) are 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, and 12. (a total of 11 possible outcomes.) In addition, each outcome must have a known probability (in this case: 1/36, 1/18, 1/12, 1/9, 5/36, 1/6, 5/36, 1/9, 1/12, 1/18, 1/36). To apply the Chi-square ( 2 ) test, a large number of experiments, n, must be performed, and a count kept of how many times each an outcome falls in each category. We then compare, in some way, the results of this experiment with predicted results based on the probabilities. We label the probabilities p i, 1 <= i <= k. Then the predicted number of outcomes for category i in n experiments is np i. For example, the predicted probability of throwing 3 on a k pair of dice is 1/18, so that if we throw the dice 1000 times, the expected number of times a 3 should appear is 1000 x 1/18 = Let s further assume that in the actual experiment a 3 appeared 60 times. What can we say about the reliability of the dice? The Chi-square test measures the variance of the expected value from the predicted value for each category using the formula V i = (N i - np i ) 2 /np i The difference is squared to eliminate negative values for V i. Finally, the Chisquare value, V, is obtained by summing the V i over all k categories. V = V i = (N i - np i ) 2 /np i where the summation is over all i, 1<= i <= k. Finally, the value obtained for V needs to be interpreted, and this is done by looking V up in a table of Chi-square distribution. Generating a random sequence of binary digits. a. Double the number (shift left one digit) b. If no overflow, use low order bit as next random binary bit c. else Exclusive-Or with c. Algebraically, we generate a sequence of random numbers in a word of length w, NTC 4/24/05 190
7 and use the low order bit. The numbers of length w can be described algebraically as X n = (2X n-1 ) mod 2 w if 2X n-1 < 2 w, and [R4] X n = (2X n-1 c) mod 2 w if 2X n-1 2 w. The next binary digit is then the least significant bit of X n, which can be expressed as b n = X n mod 2 This will produce a sequence of length 2 k -1 where k is the word length and c contains the coefficients of a primitive polynomial modulo 2. (pg27 Knuth) Example: let the word length = 4 and c = Then the sequence of 4-bit words generated by [R4] is NTC 4/24/05 191
Algorithms and Networking for Computer Games
Algorithms and Networking for Computer Games Chapter 2: Random Numbers http://www.wiley.com/go/smed What are random numbers good for (according to D.E. Knuth) simulation sampling numerical analysis computer
More informationCPSC 531: Random Numbers. Jonathan Hudson Department of Computer Science University of Calgary
CPSC 531: Random Numbers Jonathan Hudson Department of Computer Science University of Calgary http://www.ucalgary.ca/~hudsonj/531f17 Introduction In simulations, we generate random values for variables
More informationSlides 3: Random Numbers
Slides 3: Random Numbers We previously considered a few examples of simulating real processes. In order to mimic real randomness of events such as arrival times we considered the use of random numbers
More informationLehmer Random Number Generators: Introduction
Lehmer Random Number Generators: Introduction Revised version of the slides based on the book Discrete-Event Simulation: a first course LL Leemis & SK Park Section(s) 21, 22 c 2006 Pearson Ed, Inc 0-13-142917-5
More informationReview of Statistical Terminology
Review of Statistical Terminology An experiment is a process whose outcome is not known with certainty. The experiment s sample space S is the set of all possible outcomes. A random variable is a function
More informationTopic Contents. Factoring Methods. Unit 3: Factoring Methods. Finding the square root of a number
Topic Contents Factoring Methods Unit 3 The smallest divisor of an integer The GCD of two numbers Generating prime numbers Computing prime factors of an integer Generating pseudo random numbers Raising
More informationHow does the computer generate observations from various distributions specified after input analysis?
1 How does the computer generate observations from various distributions specified after input analysis? There are two main components to the generation of observations from probability distributions.
More information1 Probability Review. CS 124 Section #8 Hashing, Skip Lists 3/20/17. Expectation (weighted average): the expectation of a random quantity X is:
CS 24 Section #8 Hashing, Skip Lists 3/20/7 Probability Review Expectation (weighted average): the expectation of a random quantity X is: x= x P (X = x) For each value x that X can take on, we look at
More informationB. Maddah ENMG 622 Simulation 11/11/08
B. Maddah ENMG 622 Simulation 11/11/08 Random-Number Generators (Chapter 7, Law) Overview All stochastic simulations need to generate IID uniformly distributed on (0,1), U(0,1), random numbers. 1 f X (
More informationInteger factorization, part 1: the Q sieve. D. J. Bernstein
Integer factorization, part 1: the Q sieve D. J. Bernstein Sieving small integers 0 using primes 3 5 7: 1 3 3 4 5 5 6 3 7 7 8 9 3 3 10 5 11 1 3 13 14 7 15 3 5 16 17 18 3 3 19 0 5 etc. Sieving and 611 +
More informationCounting. 1 Sum Rule. Example 1. Lecture Notes #1 Sept 24, Chris Piech CS 109
1 Chris Piech CS 109 Counting Lecture Notes #1 Sept 24, 2018 Based on a handout by Mehran Sahami with examples by Peter Norvig Although you may have thought you had a pretty good grasp on the notion of
More information2008 Winton. Review of Statistical Terminology
1 Review of Statistical Terminology 2 Formal Terminology An experiment is a process whose outcome is not known with certainty The experiment s sample space S is the set of all possible outcomes. A random
More informationcse 311: foundations of computing Fall 2015 Lecture 11: Modular arithmetic and applications
cse 311: foundations of computing Fall 2015 Lecture 11: Modular arithmetic and applications arithmetic mod 7 a + 7 b = (a + b) mod 7 a 7 b = (a b) mod 7 5 6 0 1 2 4 3 + 0 1 2 3 4 5 6 0 0 1 2 3 4 5 6 1
More informationRandom Number Generation. CS1538: Introduction to simulations
Random Number Generation CS1538: Introduction to simulations Random Numbers Stochastic simulations require random data True random data cannot come from an algorithm We must obtain it from some process
More informationExecutive Assessment. Executive Assessment Math Review. Section 1.0, Arithmetic, includes the following topics:
Executive Assessment Math Review Although the following provides a review of some of the mathematical concepts of arithmetic and algebra, it is not intended to be a textbook. You should use this chapter
More informationContinuing discussion of CRC s, especially looking at two-bit errors
Continuing discussion of CRC s, especially looking at two-bit errors The definition of primitive binary polynomials Brute force checking for primitivity A theorem giving a better test for primitivity Fast
More informationB.N.Bandodkar College of Science, Thane. Random-Number Generation. Mrs M.J.Gholba
B.N.Bandodkar College of Science, Thane Random-Number Generation Mrs M.J.Gholba Properties of Random Numbers A sequence of random numbers, R, R,., must have two important statistical properties, uniformity
More informationRandomized Algorithms
Randomized Algorithms Prof. Tapio Elomaa tapio.elomaa@tut.fi Course Basics A new 4 credit unit course Part of Theoretical Computer Science courses at the Department of Mathematics There will be 4 hours
More informationGenerating Uniform Random Numbers
1 / 41 Generating Uniform Random Numbers Christos Alexopoulos and Dave Goldsman Georgia Institute of Technology, Atlanta, GA, USA 10/13/16 2 / 41 Outline 1 Introduction 2 Some Lousy Generators We Won t
More informationCSCE 564, Fall 2001 Notes 6 Page 1 13 Random Numbers The great metaphysical truth in the generation of random numbers is this: If you want a function
CSCE 564, Fall 2001 Notes 6 Page 1 13 Random Numbers The great metaphysical truth in the generation of random numbers is this: If you want a function that is reasonably random in behavior, then take any
More informationHMMT February 2018 February 10, 2018
HMMT February 018 February 10, 018 Algebra and Number Theory 1. For some real number c, the graphs of the equation y = x 0 + x + 18 and the line y = x + c intersect at exactly one point. What is c? 18
More informationGenerating Uniform Random Numbers
1 / 44 Generating Uniform Random Numbers Christos Alexopoulos and Dave Goldsman Georgia Institute of Technology, Atlanta, GA, USA 10/29/17 2 / 44 Outline 1 Introduction 2 Some Lousy Generators We Won t
More information4 Number Theory and Cryptography
4 Number Theory and Cryptography 4.1 Divisibility and Modular Arithmetic This section introduces the basics of number theory number theory is the part of mathematics involving integers and their properties.
More information3 The fundamentals: Algorithms, the integers, and matrices
3 The fundamentals: Algorithms, the integers, and matrices 3.4 The integers and division This section introduces the basics of number theory number theory is the part of mathematics involving integers
More informationIntermediate Math Circles November 8, 2017 Probability II
Intersection of Events and Independence Consider two groups of pairs of events Intermediate Math Circles November 8, 017 Probability II Group 1 (Dependent Events) A = {a sales associate has training} B
More informationNORTHWESTERN UNIVERSITY Tuesday, Oct 6th, 2015 ANSWERS FALL 2015 NU PUTNAM SELECTION TEST
Problem A1. Show that log(1 + x) > x/(1 + x) for all x > 0. - Answer: We have that (log x) = 1/(1+x), and (x/(1+x)) = 1/(1+x) 2. Since 1/(1+x) > 1/(1 + x) 2 for x > 0, the function log x grows faster than
More informationPseudo-Random Generators
Pseudo-Random Generators Why do we need random numbers? Simulation Sampling Numerical analysis Computer programming (e.g. randomized algorithm) Elementary and critical element in many cryptographic protocols
More informationA brief review of basics of probabilities
brief review of basics of probabilities Milos Hauskrecht milos@pitt.edu 5329 Sennott Square robability theory Studies and describes random processes and their outcomes Random processes may result in multiple
More informationPseudo-Random Generators
Pseudo-Random Generators Topics Why do we need random numbers? Truly random and Pseudo-random numbers. Definition of pseudo-random-generator What do we expect from pseudorandomness? Testing for pseudo-randomness.
More informationChapter 4: Monte Carlo Methods. Paisan Nakmahachalasint
Chapter 4: Monte Carlo Methods Paisan Nakmahachalasint Introduction Monte Carlo Methods are a class of computational algorithms that rely on repeated random sampling to compute their results. Monte Carlo
More informationGenerating Uniform Random Numbers
1 / 43 Generating Uniform Random Numbers Christos Alexopoulos and Dave Goldsman Georgia Institute of Technology, Atlanta, GA, USA March 1, 2016 2 / 43 Outline 1 Introduction 2 Some Generators We Won t
More informationSelected problems from past exams and a few additional problems
Discrete Structures CS2800 Prelim 1 sample questions s Selected problems from past exams and a few additional problems 1. Compute (10101) 2 + (101) 2. Express your answer in both binary and decimal. There
More informationTopics. Pseudo-Random Generators. Pseudo-Random Numbers. Truly Random Numbers
Topics Pseudo-Random Generators Why do we need random numbers? Truly random and Pseudo-random numbers. Definition of pseudo-random-generator What do we expect from pseudorandomness? Testing for pseudo-randomness.
More informationHow does the computer generate observations from various distributions specified after input analysis?
1 How does the computer generate observations from various distributions specified after input analysis? There are two main components to the generation of observations from probability distributions.
More informationRandomized Algorithms, Spring 2014: Project 2
Randomized Algorithms, Spring 2014: Project 2 version 1 March 6, 2014 This project has both theoretical and practical aspects. The subproblems outlines a possible approach. If you follow the suggested
More informationDiscrete Random Variables
Discrete Random Variables An Undergraduate Introduction to Financial Mathematics J. Robert Buchanan Introduction The markets can be thought of as a complex interaction of a large number of random processes,
More informationSection 2.1: Lehmer Random Number Generators: Introduction
Section 21: Lehmer Random Number Generators: Introduction Discrete-Event Simulation: A First Course c 2006 Pearson Ed, Inc 0-13-142917-5 Discrete-Event Simulation: A First Course Section 21: Lehmer Random
More informationMath 312/ AMS 351 (Fall 17) Sample Questions for Final
Math 312/ AMS 351 (Fall 17) Sample Questions for Final 1. Solve the system of equations 2x 1 mod 3 x 2 mod 7 x 7 mod 8 First note that the inverse of 2 is 2 mod 3. Thus, the first equation becomes (multiply
More informationCOMP6053 lecture: Sampling and the central limit theorem. Jason Noble,
COMP6053 lecture: Sampling and the central limit theorem Jason Noble, jn2@ecs.soton.ac.uk Populations: long-run distributions Two kinds of distributions: populations and samples. A population is the set
More informationUniform random numbers generators
Uniform random numbers generators Lecturer: Dmitri A. Moltchanov E-mail: moltchan@cs.tut.fi http://www.cs.tut.fi/kurssit/tlt-2707/ OUTLINE: The need for random numbers; Basic steps in generation; Uniformly
More information4.5 Applications of Congruences
4.5 Applications of Congruences 287 66. Find all solutions of the congruence x 2 16 (mod 105). [Hint: Find the solutions of this congruence modulo 3, modulo 5, and modulo 7, and then use the Chinese remainder
More informationSTA 247 Solutions to Assignment #1
STA 247 Solutions to Assignment #1 Question 1: Suppose you throw three six-sided dice (coloured red, green, and blue) repeatedly, until the three dice all show different numbers. Assuming that these dice
More information5.3 Conditional Probability and Independence
28 CHAPTER 5. PROBABILITY 5. Conditional Probability and Independence 5.. Conditional Probability Two cubical dice each have a triangle painted on one side, a circle painted on two sides and a square painted
More informationLecture 23: Alternation vs. Counting
CS 710: Complexity Theory 4/13/010 Lecture 3: Alternation vs. Counting Instructor: Dieter van Melkebeek Scribe: Jeff Kinne & Mushfeq Khan We introduced counting complexity classes in the previous lecture
More informationcse 311: foundations of computing Fall 2015 Lecture 12: Primes, GCD, applications
cse 311: foundations of computing Fall 2015 Lecture 12: Primes, GCD, applications n-bit unsigned integer representation Represent integer x as sum of powers of 2: If x = n 1 i=0 b i 2 i where each b i
More information12 1 = = 1
Basic Probability: Problem Set One Summer 07.3. We have A B B P (A B) P (B) 3. We also have from the inclusion-exclusion principle that since P (A B). P (A B) P (A) + P (B) P (A B) 3 P (A B) 3 For examples
More information2x 1 7. A linear congruence in modular arithmetic is an equation of the form. Why is the solution a set of integers rather than a unique integer?
Chapter 3: Theory of Modular Arithmetic 25 SECTION C Solving Linear Congruences By the end of this section you will be able to solve congruence equations determine the number of solutions find the multiplicative
More informationCourse: ESO-209 Home Work: 1 Instructor: Debasis Kundu
Home Work: 1 1. Describe the sample space when a coin is tossed (a) once, (b) three times, (c) n times, (d) an infinite number of times. 2. A coin is tossed until for the first time the same result appear
More informationSources of randomness
Random Number Generator Chapter 7 In simulations, we generate random values for variables with a specified distribution Ex., model service times using the exponential distribution Generation of random
More informationMAT Mathematics in Today's World
MAT 1000 Mathematics in Today's World Last Time We discussed the four rules that govern probabilities: 1. Probabilities are numbers between 0 and 1 2. The probability an event does not occur is 1 minus
More information1. When applied to an affected person, the test comes up positive in 90% of cases, and negative in 10% (these are called false negatives ).
CS 70 Discrete Mathematics for CS Spring 2006 Vazirani Lecture 8 Conditional Probability A pharmaceutical company is marketing a new test for a certain medical condition. According to clinical trials,
More informationSTAT 201 Chapter 5. Probability
STAT 201 Chapter 5 Probability 1 2 Introduction to Probability Probability The way we quantify uncertainty. Subjective Probability A probability derived from an individual's personal judgment about whether
More informationLecture 6: Introducing Complexity
COMP26120: Algorithms and Imperative Programming Lecture 6: Introducing Complexity Ian Pratt-Hartmann Room KB2.38: email: ipratt@cs.man.ac.uk 2015 16 You need this book: Make sure you use the up-to-date
More informationNumber Theory: Applications. Number Theory Applications. Hash Functions II. Hash Functions III. Pseudorandom Numbers
Number Theory: Applications Number Theory Applications Computer Science & Engineering 235: Discrete Mathematics Christopher M. Bourke cbourke@cse.unl.edu Results from Number Theory have many applications
More informationGenerating Random Variables
Generating Random Variables These slides are created by Dr. Yih Huang of George Mason University. Students registered in Dr. Huang's courses at GMU can make a single machine-readable copy and print a single
More informationFunctions and cardinality (solutions) sections A and F TA: Clive Newstead 6 th May 2014
Functions and cardinality (solutions) 21-127 sections A and F TA: Clive Newstead 6 th May 2014 What follows is a somewhat hastily written collection of solutions for my review sheet. I have omitted some
More informationProbability COMP 245 STATISTICS. Dr N A Heard. 1 Sample Spaces and Events Sample Spaces Events Combinations of Events...
Probability COMP 245 STATISTICS Dr N A Heard Contents Sample Spaces and Events. Sample Spaces........................................2 Events........................................... 2.3 Combinations
More information6.045: Automata, Computability, and Complexity (GITCS) Class 17 Nancy Lynch
6.045: Automata, Computability, and Complexity (GITCS) Class 17 Nancy Lynch Today Probabilistic Turing Machines and Probabilistic Time Complexity Classes Now add a new capability to standard TMs: random
More informationCOMP6053 lecture: Sampling and the central limit theorem. Markus Brede,
COMP6053 lecture: Sampling and the central limit theorem Markus Brede, mb8@ecs.soton.ac.uk Populations: long-run distributions Two kinds of distributions: populations and samples. A population is the set
More informationCPSC 467: Cryptography and Computer Security
CPSC 467: Cryptography and Computer Security Michael J. Fischer Lecture 21 November 15, 2017 CPSC 467, Lecture 21 1/31 Secure Random Sequence Generators Pseudorandom sequence generators Looking random
More informationRandom processes and probability distributions. Phys 420/580 Lecture 20
Random processes and probability distributions Phys 420/580 Lecture 20 Random processes Many physical processes are random in character: e.g., nuclear decay (Poisson distributed event count) P (k, τ) =
More informationDiscrete Mathematics and Probability Theory Spring 2016 Rao and Walrand Note 14
CS 70 Discrete Mathematics and Probability Theory Spring 2016 Rao and Walrand Note 14 Introduction One of the key properties of coin flips is independence: if you flip a fair coin ten times and get ten
More informationCPSC 467b: Cryptography and Computer Security
CPSC 467b: Cryptography and Computer Security Michael J. Fischer Lecture 10 February 19, 2013 CPSC 467b, Lecture 10 1/45 Primality Tests Strong primality tests Weak tests of compositeness Reformulation
More informationSo far we discussed random number generators that need to have the maximum length period.
So far we discussed random number generators that need to have the maximum length period. Even the increment series has the maximum length period yet it is by no means random How do we decide if a generator
More informationDiscrete Random Variables
Discrete Random Variables An Undergraduate Introduction to Financial Mathematics J. Robert Buchanan 2014 Introduction The markets can be thought of as a complex interaction of a large number of random
More informationSTEP Support Programme. Hints and Partial Solutions for Assignment 17
STEP Support Programme Hints and Partial Solutions for Assignment 7 Warm-up You need to be quite careful with these proofs to ensure that you are not assuming something that should not be assumed. For
More informationLinear Feedback Shift Registers (LFSRs) 4-bit LFSR
Linear Feedback Shift Registers (LFSRs) These are n-bit counters exhibiting pseudo-random behavior. Built from simple shift-registers with a small number of xor gates. Used for: random number generation
More information2x 1 7. A linear congruence in modular arithmetic is an equation of the form. Why is the solution a set of integers rather than a unique integer?
Chapter 3: Theory of Modular Arithmetic 25 SECTION C Solving Linear Congruences By the end of this section you will be able to solve congruence equations determine the number of solutions find the multiplicative
More informationLecture 10: Probability distributions TUESDAY, FEBRUARY 19, 2019
Lecture 10: Probability distributions DANIEL WELLER TUESDAY, FEBRUARY 19, 2019 Agenda What is probability? (again) Describing probabilities (distributions) Understanding probabilities (expectation) Partial
More informationSimulation Modeling. Random Numbers
Mathematical Modeling Lia Vas Simulation Modeling. Random Numbers In many cases one of the following situations might occur: - It is not possible to observe the behavior directly or to conduct experiments.
More informationNotes. Number Theory: Applications. Notes. Number Theory: Applications. Notes. Hash Functions I
Number Theory: Applications Slides by Christopher M. Bourke Instructor: Berthe Y. Choueiry Fall 2007 Computer Science & Engineering 235 Introduction to Discrete Mathematics Sections 3.4 3.7 of Rosen cse235@cse.unl.edu
More informationAlgorithms (II) Yu Yu. Shanghai Jiaotong University
Algorithms (II) Yu Yu Shanghai Jiaotong University Chapter 1. Algorithms with Numbers Two seemingly similar problems Factoring: Given a number N, express it as a product of its prime factors. Primality:
More informationCosc 412: Cryptography and complexity Lecture 7 (22/8/2018) Knapsacks and attacks
1 Cosc 412: Cryptography and complexity Lecture 7 (22/8/2018) Knapsacks and attacks Michael Albert michael.albert@cs.otago.ac.nz 2 This week Arithmetic Knapsack cryptosystems Attacks on knapsacks Some
More informationIntegers and Division
Integers and Division Notations Z: set of integers N : set of natural numbers R: set of real numbers Z + : set of positive integers Some elements of number theory are needed in: Data structures, Random
More informationFERMAT S TEST KEITH CONRAD
FERMAT S TEST KEITH CONRAD 1. Introduction Fermat s little theorem says for prime p that a p 1 1 mod p for all a 0 mod p. A naive extension of this to a composite modulus n 2 would be: for all a 0 mod
More information6.842 Randomness and Computation Lecture 5
6.842 Randomness and Computation 2012-02-22 Lecture 5 Lecturer: Ronitt Rubinfeld Scribe: Michael Forbes 1 Overview Today we will define the notion of a pairwise independent hash function, and discuss its
More informationCS 151 Complexity Theory Spring Solution Set 5
CS 151 Complexity Theory Spring 2017 Solution Set 5 Posted: May 17 Chris Umans 1. We are given a Boolean circuit C on n variables x 1, x 2,..., x n with m, and gates. Our 3-CNF formula will have m auxiliary
More informationCS280, Spring 2004: Final
CS280, Spring 2004: Final 1. [4 points] Which of the following relations on {0, 1, 2, 3} is an equivalence relation. (If it is, explain why. If it isn t, explain why not.) Just saying Yes or No with no
More information11 Division Mod n, Linear Integer Equations, Random Numbers, The Fundamental Theorem of Arithmetic
11 Division Mod n, Linear Integer Equations, Random Numbers, The Fundamental Theorem of Arithmetic Bezout s Lemma Let's look at the values of 4x + 6y when x and y are integers. If x is -6 and y is 4 we
More information1: Please compute the Jacobi symbol ( 99
SCORE/xx: Math 470 Communications Cryptography NAME: PRACTICE FINAL Please show your work write only in pen. Notes are forbidden. Calculators, all other electronic devices, are forbidden. Brains are encouraged,
More informationStream Ciphers. Çetin Kaya Koç Winter / 20
Çetin Kaya Koç http://koclab.cs.ucsb.edu Winter 2016 1 / 20 Linear Congruential Generators A linear congruential generator produces a sequence of integers x i for i = 1,2,... starting with the given initial
More informationQuantum Computation CMU BB, Fall Week 6 work: Oct. 11 Oct hour week Obligatory problems are marked with [ ]
Quantum Computation CMU 15-859BB, Fall 2018 Week 6 work: Oct. 11 Oct. 18 12-hour week Obligatory problems are marked with [ ] 1. [CCNOT.] In class we showed how to simulate classical AND, OR, NOT, and
More informationP (A) = P (B) = P (C) = P (D) =
STAT 145 CHAPTER 12 - PROBABILITY - STUDENT VERSION The probability of a random event, is the proportion of times the event will occur in a large number of repititions. For example, when flipping a coin,
More informationLecture Slides. Elementary Statistics Eleventh Edition. by Mario F. Triola. and the Triola Statistics Series 4.1-1
Lecture Slides Elementary Statistics Eleventh Edition and the Triola Statistics Series by Mario F. Triola 4.1-1 4-1 Review and Preview Chapter 4 Probability 4-2 Basic Concepts of Probability 4-3 Addition
More information18.310A Final exam practice questions
18.310A Final exam practice questions This is a collection of practice questions, gathered randomly from previous exams and quizzes. They may not be representative of what will be on the final. In particular,
More informationMATH 115, SUMMER 2012 LECTURE 4 THURSDAY, JUNE 21ST
MATH 115, SUMMER 2012 LECTURE 4 THURSDAY, JUNE 21ST JAMES MCIVOR Today we enter Chapter 2, which is the heart of this subject. Before starting, recall that last time we saw the integers have unique factorization
More informationLecture 2. The Euclidean Algorithm and Numbers in Other Bases
Lecture 2. The Euclidean Algorithm and Numbers in Other Bases At the end of Lecture 1, we gave formulas for the greatest common divisor GCD (a, b), and the least common multiple LCM (a, b) of two integers
More informationPh 219b/CS 219b. Exercises Due: Wednesday 22 February 2006
1 Ph 219b/CS 219b Exercises Due: Wednesday 22 February 2006 6.1 Estimating the trace of a unitary matrix Recall that using an oracle that applies the conditional unitary Λ(U), Λ(U): 0 ψ 0 ψ, 1 ψ 1 U ψ
More informationA Repetition Test for Pseudo-Random Number Generators
Monte Carlo Methods and Appl., Vol. 12, No. 5-6, pp. 385 393 (2006) c VSP 2006 A Repetition Test for Pseudo-Random Number Generators Manuel Gil, Gaston H. Gonnet, Wesley P. Petersen SAM, Mathematik, ETHZ,
More informationRandom Number Generators - a brief assessment of those available
Random Number Generators - a brief assessment of those available Anna Mills March 30, 2003 1 Introduction Nothing in nature is random...a thing appears random only through the incompleteness of our knowledge.
More informationLinear Congruences. The equation ax = b for a, b R is uniquely solvable if a 0: x = b/a. Want to extend to the linear congruence:
Linear Congruences The equation ax = b for a, b R is uniquely solvable if a 0: x = b/a. Want to extend to the linear congruence: ax b (mod m), a, b Z, m N +. (1) If x 0 is a solution then so is x k :=
More informationReview of probabilities
CS 1675 Introduction to Machine Learning Lecture 5 Density estimation Milos Hauskrecht milos@pitt.edu 5329 Sennott Square Review of probabilities 1 robability theory Studies and describes random processes
More informationFirst Digit Tally Marks Final Count
Benford Test () Imagine that you are a forensic accountant, presented with the two data sets on this sheet of paper (front and back). Which of the two sets should be investigated further? Why? () () ()
More informationREVIEW QUESTIONS. Chapter 1: Foundations: Sets, Logic, and Algorithms
REVIEW QUESTIONS Chapter 1: Foundations: Sets, Logic, and Algorithms 1. Why can t a Venn diagram be used to prove a statement about sets? 2. Suppose S is a set with n elements. Explain why the power set
More information6.080 / Great Ideas in Theoretical Computer Science Spring 2008
MIT OpenCourseWare http://ocw.mit.edu 6.080 / 6.089 Great Ideas in Theoretical Computer Science Spring 2008 For information about citing these materials or our Terms of Use, visit: http://ocw.mit.edu/terms.
More informationTHE SOLOVAY STRASSEN TEST
THE SOLOVAY STRASSEN TEST KEITH CONRAD 1. Introduction The Jacobi symbol satisfies many formulas that the Legendre symbol does, such as these: for a, b Z and odd m, n Z +, (1) a b mod n ( a n ) = ( b n
More informationMACHINE COMPUTING. the limitations
MACHINE COMPUTING the limitations human computing stealing brain cycles of the masses word recognition: to digitize all printed writing language education: to translate web content games with a purpose
More informationChapter 2.5 Random Variables and Probability The Modern View (cont.)
Chapter 2.5 Random Variables and Probability The Modern View (cont.) I. Statistical Independence A crucially important idea in probability and statistics is the concept of statistical independence. Suppose
More information(x 1 +x 2 )(x 1 x 2 )+(x 2 +x 3 )(x 2 x 3 )+(x 3 +x 1 )(x 3 x 1 ).
CMPSCI611: Verifying Polynomial Identities Lecture 13 Here is a problem that has a polynomial-time randomized solution, but so far no poly-time deterministic solution. Let F be any field and let Q(x 1,...,
More information