Most Random Number - PowerPoint PPT Presentation

About This Presentation
Title:

Most Random Number

Description:

Tom Carter CSSS 2004 Here s a somewhat strange question . . . What is the most random number between 1 and 1000? How to go at it? Let s try to develop a ... – PowerPoint PPT presentation

Number of Views:38
Avg rating:3.0/5.0
Slides: 18
Provided by: csustanCs5
Category:
Tags: number | random

less

Transcript and Presenter's Notes

Title: Most Random Number


1
Most Random Number
  • Tom Carter
  • CSSS
  • 2004

2
Heres a somewhat strange question . . .
  • What is the most random number between 1 and 1000?

3
How to go at it?
  • Lets try to develop a probability distribution
    function representing some general notion of a
    randomness property for numbers . . . -)

4
First guess everything is normal, right?
5
  • Too simple. We do get a unique maximum at 500,
    but that cant be right.
  • As everybody knows, you never get the actual data
    value. There are always errors that push you
    away from the real value.
  • So, we should overlay a repelling error
    dark-force on top.

6
Error dark-force
7
Overlay the dark-force on the normal distribution
8
  • Now were getting somewhere!
  • But, we dont have a unique maximum any more.
  • There must be a bias in one direction or the
    other, mustnt there?

9
  • Aha! We forgot about Benfords law on the
    distribution of significant digits.
  • One form of Benfords law says that on average,
    the proportion of numbers having first digit less
    than d will be about log(d1) for d 1, 2, . .
    ., 9.
  • Another way to say this is that the distribution
    will be approximately 1/(d1), so well overlay a
    power law

10
1/(x/100 1)
11
Normal, with dark-forceand digit overlay
12
  • Now were almost done. We have a single maximum,
    and it is not the simplistic 500.
  • One more piece. Random numbers must not have
    special properties, right?
  • So, they probably wont be divisible by small
    primes like 2 or 3 or 5.
  • Lets write a couple of small MatLab functions
    for all this.

13
function r mrn(x) "most random number"
function -) r (1/((x/100) 1)) (1 -
normpdf(x, 500, 70) normpdf(500,500,70))
normpdf(x, 500, 167)
function r maxrn search for "most random
number" using mrn(x) maxval 0 maxrn 0 for n
11000 if rem(n,2) 0 rem(n,3) 0
rem(n,5) 0 mrn(n) gt maxval
maxval mrn(n) maxrn
n end end r maxrn
14
Now we run our function, and there it is, the
most random number between 1 and 1000
gtgt maxrn ans 347
15
  • What about more general versions of this?
  • In other words, what about the most random number
    between 1 and 10, 1 and 100, 1 and 10000, etc.?

16
function r mrng(x,maxn) "most random number"
function -) r (1/((10x/maxn) 1)) (1 -
normpdf(x, maxn/2, 0.07maxn)/normpdf(maxn/2,maxn/
2,0.07maxn)) normpdf(x, maxn/2, maxn/6)
function r maxrng(maxn) search for "most
random number" using mrng(x,maxn) maxval
0 maxrn 0 for n 1maxn if rem(n,2) 0
rem(n,3) 0 rem(n,5) 0 mrng(n,maxn) gt
maxval maxval
mrng(n,maxn) maxrn n
end end r maxrn
17
Summary of most random numbers
  • 1 to 10 7
  • 1 to 50 17
  • 1 to 100 37
  • 1 to 500 173
  • 1 to 1000 347
  • 1 to 10,000 3,479
  • 1 to 100,000 34,799
  • 1 to 1,000,000 347,971
Write a Comment
User Comments (0)
About PowerShow.com