True Random Number
T Chap
Posts: 4,223
Anyone have an idea on generating a True random number?
?X is not it
Incorporating the CNT into a formula may work, but even then it is derived. I am looking for the closest thing to the brain picking a number between -2B and 2B, preferably not time based.
I suppose a computer can do nothing without some formula even in generating randomness.
?X is not it
Incorporating the CNT into a formula may work, but even then it is derived. I am looking for the closest thing to the brain picking a number between -2B and 2B, preferably not time based.
I suppose a computer can do nothing without some formula even in generating randomness.
Comments
▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
Paul Baker
Propeller Applications Engineer
Parallax, Inc.
▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
Parallax Forums - If you're ready to learn, we're ready to help.
▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
Paul Baker
Propeller Applications Engineer
Parallax, Inc.
Post Edited (Paul Baker (Parallax)) : 3/17/2007 3:23:05 AM GMT
The internal ~20KHz oscillator is a free-running analog oscillator and is used to sync between clock selections when CLKSEL is written to (via CLKSET(mode, frequency). It takes two of these clock cycles to get through a CLKSET instruction in Spin, but how long this actually takes varies, because of the phase relationship to the ~20KHz clock (~50us to ~100us of delay will occur). So, if you do a:
t := cnt
clkset(clkmode,clkfreq)·· 'rewrite CLKSEL with the same data
t := cnt - t
...While running at 80MHz, there will be a random ~50us variance in t which, at 80MHz, will translate into ~4000 units. The only problem with this is that the whole chip's master clock will slow to ~20KHz for one to two cycles, so a big time hiccup occurs.
I think that practically speaking, if you are waiting on some asynchronous external event to begin some process that needs a random number, the CNT will be effectively random, especially if the random ? operator is used.
▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
Chip Gracey
Parallax, Inc.
please correct me if I am off
▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
Parallax Forums - If you're ready to learn, we're ready to help.
I want to be able to affect the outcome of the number with thoughts. If the number is above 0, a Green LED and a tone of 1k sounds on a speaker. If < 0, a Red LED and a of tone of 700 plays.
I was studying the supposedly "verifyable" effects of thought on the outcome of physical events from people concentrating on the test. If a ball can be affected as to where is lands after striking a number of randomly placed obstacles in it's downward path, then one of two choices of LEDs should be able to get affected as well. We'll soon see if this is true. I am testing Chips code now.
Post Edited (originator) : 3/17/2007 3:51:39 AM GMT
▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
Parallax Forums - If you're ready to learn, we're ready to help.
Here's the program listing:
-Phil
Post Edited (Phil Pilgrim (PhiPi)) : 3/17/2007 5:39:05 AM GMT
-Phil
Chip Gracey
Parallax, Inc.