* Your assessment is very important for improving the workof artificial intelligence, which forms the content of this project
Download The Random Module Randrange Randrange Randint Function
Survey
Document related concepts
Abuse of notation wikipedia , lookup
History of the function concept wikipedia , lookup
Function (mathematics) wikipedia , lookup
Non-standard calculus wikipedia , lookup
Proofs of Fermat's little theorem wikipedia , lookup
Infinite monkey theorem wikipedia , lookup
Transcript
2/9/09 Randrange • randrange( [start,] stop [, step] ) The Random Module – Returns a randomly selected element from the specified range – works with integers Creates pseudo-random numbers Coming up: Randrange Randrange • randrange( [start,] stop [, step] ) Randint Function • randint(a,b) – returns a random integer N such that: • a ≤ N ≤ b 1 2/9/09 Choice function • choice( sequence ) – Returns a random element from a nonempty sequence (e.g. a String) Uniform Function • uniform(a,b) – Returns a random real number N such that: Random function • random() – Returns the next random floating point number in the range 0.0 1.0 How random is it? • Lets plot some random points and see what it looks like • a ≤ N < b • randomTest/RandomTester.py • (Note: This code is to demonstrate random only… we haven’t yet learned many concepts used in the program) 2