Random Number Generation -----> Hardware or Software?

Hi every one, I would like 2 ask about the random number generation. Is random number generation function/method in programming languages implemented in software layer or in hardware layer, and if it is implemented in software layer, how it is implemented in the regular calculator i.e. pocket calculator (not calculator program). thanx

Reply to
Motaz K. Saad
Loading thread data ...

to

This is Usenet is not a cellphone.

Usually software. Sometimes hardware. Sometimes a combination.

You'd have to ask the calculator's manufacturer.

--
Grant Edwards                   grante             Yow!  Is a tattoo
                                  at               real, like a curb or a
                               visi.com            battleship? Or are we
                                                   suffering in Safeway?
Reply to
Grant Edwards

In article , "Motaz K. Saad" writes: |>

|> I would like 2 ask about the random number generation. |> Is random number generation function/method in programming languages |> implemented in software layer or in hardware layer, and if it is |> implemented in software layer, how it is implemented in the regular |> calculator i.e. pocket calculator (not calculator program).

Software. It would have been in hardware back in the days of the first calculators, but now most of them use a fairly general- purpose chip that executes a program from ROM, PROM or whatever. Call it firmware if you like. I can't tell you how many use a specialised hardware random number generator (which exist), if any do.

Regards, Nick Maclaren.

Reply to
Nick Maclaren

Note also that these (software) library functions generate *pseudo-random* sequences. True random sequences are impossible to be achieved by solely software means.

Vadim

Reply to
Vadim Borshchev

Actually there are no software random number generators. Generating random numbers is very difficult.

del cecchi

Reply to
Del Cecchi

In article , Del Cecchi writes: |> |> Actually there are no software random number generators. Generating |> random numbers is very difficult.

If it is impossible to determine that a generator is not truly random without invoking godlike powers, is it random?

Therefore, if it is infeasible to determine that a black-box pseudo-random generator is not truly random without breaking open the black box, should it be regarded as random?

You can ask exactly the same about a quantum state. If you answer "yes" and "no" to the above, then physical randomness would disappear if anyone ever found a way of measuring a quantum state directly, however impractical.

The philosophy of randomness is a lot more complex than most people realise.

Regards, Nick Maclaren.

Reply to
Nick Maclaren

I used to agree with you, but I changed my mind. :-)

Reply to
Del Cecchi

Anyone who considers arithmetical methods of producing random digits is, of course, in a state of sin. John Von Neumann, 1951

--
David Magda , http://www.magda.ca/
Because the innovator has for enemies all those who have done well under
the old conditions, and lukewarm defenders in those who may do well 
under the new. -- Niccolo Machiavelli, _The Prince_, Chapter VI
Reply to
David Magda

Any good random number generators that I know of rely on the system clock - and specifically, are based on the number of milliseconds that have elapsed as a "seed" value.

The hardware platform will then use this seed value as an offset value into a hard-coded lookup table in memory. Two numbers generated in a row will have similar offsets into the table but their resulting values will depend on the corresponding table values at those offsets.

Basically, any crude hardware device that is able to oscilate can be used as an offset for a random number generator table, such as a simple capacitor that is able to charge and discharge. Of course, the more "randomness" that is desired, the bigger the lookup table needs to be.

A crappy random number generator could also be created to use only a lookup table and simply increase the offset into the table by 1 each time. This is not true randomness by any stretch of the imagination.

-- MT

Reply to
mark thomas

If the only way to *show* that a generator is not random is by invoking godlike powers, then for all practical purposes, this proves that the generator IS truly random and can be regarded as such.

On the other hand, if current technology is unable to prove that a generator

*is not* truly random, then for all practical purposes the generator can be treated as being truly random, but this says nothing about whether it actually *is* or *is not* truly random.

The philosopy of randomness involving "godlike powers" is a futile and pointless discussion at best, and doesn't serve to offer any insight into any practical matters. Philosophy itself as a subject is completely useless from a practical standpoint, and I don't even know why I'm wasting my time talking about it.

-- MT

To reply directly, please take all 5 occurrences of the letter 'y' out of my address.

Reply to
mark thomas

A compromise is to use the accurate timing of keystrokes. The number of keystrokes must be carfully determined to get the proper amount of randomness.

More wetware than hardware ;-)

Wim

Reply to
Wim Ton

"Generating random numbers is too important to be left to chance".

(Knuth?) ... I found a ref:

formatting link

The generation of random numbers is too important to be left to chance.

-- R.R. Coveyou

Terje

--
- 
"almost all programming can be viewed as an exercise in caching"
Reply to
Terje Mathisen

Software. The most common (and one of the simplest) is the linear congruential type, which implements:

R(n+1) = (R(n) * K1 + K2) modulo K3

and the seeding process sets R(n). The magic is in picking the various K's, which can result in fairly good or very bad pseudo random sequences. Knuth has a thorough discussion. A more complex system is the Mersenne Twister. You can google for that, or find an implementation (used for testing) within my hashlib package at:

--
"If you want to post a followup via groups.google.com, don't use
 the broken "Reply" link at the bottom of the article.  Click on 
 "show options" at the top of the article, then click on the 
 "Reply" at the bottom of the article headers." - Keith Thompson
Reply to
CBFalconer

"Nick Maclaren" wrote

Agreed. Randomness _can't_ come from a fully deterministic system. The main claim to fame of a computer is that it is deterministic, unlike those unpredictable humans.

Worse than merely difficult.

Generating pure noise with no signal is the mirror task, and just as impossible, as generating signal with no noise.

God does not play dice with the universe -> God _is_ the dice.

All one can do is try and prove it isn't random and fail.

It is not only feasible, it is dead-nuts easy to determine that a black-box is outputting pseudo-random data. Map the PRNG output on a CRT and you will soon see pattern evolving on the screen. Use the last digit to increment/decrement a line sweeping across the screen: the last digit will have a repeat to it that is much shorter than the repeat of the whole generator and the line will not slowly go up or down, it will _always_ stay around '0'. Count the frequency of same value strings (# of 1's, 11's, 111's...

0's, 00's, 000s), the numbers will be just _too_ perfect.

A dead give-away is PRNG's don't drift or have biases.

The first chapter of Knuth Vol 2 "Seminumerical Algorithms", all 170 pages of it, is dedicated to determining if a set of data is random.

Truly random _isn't_, you just can't predict how it isn't. Somewhere in a truly random string there exist the works of Shakespeare: it they aren't there then the string does not contain all possible sequences and is therefore not random.

What is the question?

In the sprit of the post, let's answer both yes and no and wait for the wave function to collapse.

Interaction with quantum events is what _creates_ randomness. You _can't_ make physical randomness disappear. You can not predict the behavior of a physical system except in general terms and short time frames.

If you can make physical randomness disappear then look out: you are simulation in some giant computer.

Infinitely complex. When randomness runs it's course the Universe ends.

Home Study Question: Are the digits of the square root of two random?

--
Nicholas O. Lindan, Cleveland, Ohio
Consulting Engineer:  Electronics; Informatics; Photonics.
To reply, remove spaces: n o lindan at ix  . netcom . com
psst.. want to buy an f-stop timer? nolindan.com/da/fstop/
Reply to
Nicholas O. Lindan

LOL. Turing proposed that all computers have a low-level radioactive source whose decay events could be used as a random number generator.

Reply to
Jim Stewart

"mark thomas" wrote

One of the oldest: predestination Vs free-will. The answer is the universe is a combination of the two, a frightfully boring answer.

I'll disagree. I believe randomness is the root of intelligence and consciousness. So does Penrose.

That's a very philosophical statement. Thought is the only thing that really matters, all else is in support of it.

Because it is more enjoyable than the other tasks that await you.

Like, I need to make some cold calls -- or maybe I will clean the kitchen floor with a toothbrush -- or maybe I will write random posts on the philosophy of randomness. Choices, choices ...

--
Nicholas O. Lindan, Cleveland, Ohio
Consulting Engineer:  Electronics; Informatics; Photonics.
To reply, remove spaces: n o lindan at ix  . netcom . com
psst.. want to buy an f-stop timer? nolindan.com/da/fstop/
Reply to
Nicholas O. Lindan

As asked before, what about sqrt(two), pi, e ...? Devil of a question.

--
Nicholas O. Lindan, Cleveland, Ohio
Consulting Engineer:  Electronics; Informatics; Photonics.
To reply, remove spaces: n o lindan at ix  . netcom . com
psst.. want to buy an f-stop timer? nolindan.com/da/fstop/
Reply to
Nicholas O. Lindan

"mark thomas" wrote

Agreed, the randomness is supplied by the timing of the human hitting the keyboard and asking for a number.

The reality is a bit different however. The result will have a constant bias. Interestingly, JvonN's method does not remove the bias.

JvonN's method for correcting an unfair coin:

If 1's and 0's have a different frequency then the data can be made unbiased by considering only strings of 01 and 10 and removing all 11..1 and 00...0 strings.

I spent a few years on the electronic generation of random numbers. It can't be done, there is always a bias, but that in itself is part of the randomness of the results. A sort of 1/f noise.

Oh, yes. The lack of 1/f noise -- the longer the timeframe the wilder the swings -- is one dead give-away to a prng. A prng has a hard limit on the length of a winning streak.

--
Nicholas O. Lindan, Cleveland, Ohio
Consulting Engineer:  Electronics; Informatics; Photonics.
To reply, remove spaces: n o lindan at ix  . netcom . com
psst.. want to buy an f-stop timer? nolindan.com/da/fstop/
Reply to
Nicholas O. Lindan

"Motaz K. Saad" wrote

In a 'programming language' random numbers are generated in software. By definition.

If we change the question to generation in 'systems' rather than languages then ...

Most systems use a pseudo random number generator that is seeded by the system clock at the start of program execution. If the program is started by the system clock you may have a slight problem.

In any case the 'random numbers' coming from a computer program aren't.

Some computers, used for cryptology and monte-carlo simulation, do have physical random number generators as a hardware accessory. One for a desk-top PC:

formatting link

The _really_ good ones, well they don't exist, do they ...

--
Nicholas O. Lindan, Cleveland, Ohio
Consulting Engineer:  Electronics; Informatics; Photonics.
To reply, remove spaces: n o lindan at ix  . netcom . com
psst.. want to buy an f-stop timer? nolindan.com/da/fstop/
Reply to
Nicholas O. Lindan

Not really in the same league IMHO:

Even though all these numbers seem to consists of effectively unpredictable digits, strange things do happen, like the totally unexpected discovery of a formula that allows you to calculate an arbitrary hex digit in pi.

Terje

--
- 
"almost all programming can be viewed as an exercise in caching"
Reply to
Terje Mathisen

ElectronDepot website is not affiliated with any of the manufacturers or service providers discussed here. All logos and trade names are the property of their respective owners.