Random post about random stuff

Recently I was given the task of generating six random lottery numbers, Simple enough – I just used the C++ rand() function, but it got me thinking, how would I write my own random number function?

Background info:
Chaos and randomness are two ideas that imply complete disorder, but they actually occur out of extremely controlled systems. Marginal differences in the starting values of a system will grow into seemingly inexplicable anarchy. For example Imagine two sets of cogs connected in two seperate lines: if the first line of cog’s starting position was moved just a millimeter then over time the two lines would become out of sync.

Math example:
We will take two numbers {x = 1, y = 1.0001}
and the recuring equation z = z^2 + C where C = x and C = y:
*
z begins as 0

Iterations z, C = x z, C = y Abs. diff Per. diff
1 1 1.0001 0.0001 0.0001%
2 2 2.0003 0.0003 0.00015%
3 5 5.0013 0.0013 0.00026%
4 26 26.0131 0.0131 0.0005%
5 677 677.682 0.682 0.001%
6 458330 459253 923 0.002%

If the system outputs integers then x and y are indestingushable until the sixth iteration, where suddenly an extra 923 comes out of ‘nowhere’. Another way to look at it is if we can’t percieve the data properly it doesn’t stop the unseen changes from taking place.

The Idea:
Generate a long sequence that starts with a pseudorandom number, we shall call the sequence x = f(x), as the sequence runs we change the amount of decimal places available – therefore changing the outcome.

For the pseudorandom number the [computer] system time would be used. If we use the least significant digit (LSD), a unit of seconds, the value will be between 0 – 9 and constantly changing.

  1. Run ten iterations of x = f(x)
  2. Clock LSD of the time as N
  3. Cap x at N decimal places
  4. Goto step 1

By the end the number would be seemingly random.

Advertisements

2 thoughts on “Random post about random stuff

  1. Dr. Ian Malcolm: “If there is one thing the history of evolution has taught us it’s that life will not be contained. Life breaks free, expands to new territories, and crashes through barriers, painfully, maybe even dangerously…” (Jurassic Park, 1993)
    He should have liked your post – and I’ll try and implement it in Matlab just for fun 🙂

  2. Pingback: Soul & Simulation | Neural Outlet..

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s