We closed this forum 18 June 2010. It has served us well since 2005 as the ALPHA forum did before it from 2002 to 2005. New discussions are ongoing at the new URL http://forum.processing.org. You'll need to sign up and get a new user account. We're sorry about that inconvenience, but we think it's better in the long run. The content on this forum will remain online.
IndexProgramming Questions & HelpSyntax Questions › True Random Numbers
Page Index Toggle Pages: 1
True Random Numbers (Read 575 times)
True Random Numbers
May 12th, 2008, 12:56pm
 
hi all,

I asked myself, how a technical setup for generating true random numbers for Processing should look like.

Atmospheric Receiver - Serial Board - Processing
FM Radio - Audio IN - Processing
Online Based Service - Java Class - Processing

Or would you recommend an Online-Based Service like http://random.irb.hr/. I wonder how the integration with Processing would work out.

Or does anyone know a simpler way to generate a true random integration in processing ?
Have there been any attempts in this yet ?

Thanx for your Opinion,
stefan
Re: True Random Numbers
Reply #1 - May 12th, 2008, 10:38pm
 
I actually wrote a paper on this once-

You could take a signal from one of these (or all of these combined) Then run it through some chaos function.:

1. microphone input noise
2. accelerometers (macbook only)
3. atmospheric light sensor (macbook only)
4. on board camera
5. special hardware - as you mentoined
6. low level HW (state of memory, cpu temperature)
7. user input (time between clicks/keystrokes)

Depends on the application obviously, and whether you need it continuously updating or just a single seed etc.  Whats it for?
Re: True Random Numbers
Reply #2 - May 12th, 2008, 11:02pm
 
hi movax,

Regarding your question. I'd like to have true random on some color changing objects, which shall kinda encrypt information with no theoretical way to decrypt it.

Can you leed deeper in the subject of a chaos function in combination with Processing and an input ?

I came across TRNG USB sticks based on capacitors. This solution sounds at all good to me. My imagination just stops at this point. How to get the numbers delivered from the TRNG (USB) into Processing. Saving it to a textfile and having Processing to read it doesn't seem to be a fast solution.

My questions circles concretely around: Where will the random information get stored and trough which way will processing be able to pick it up ?

Thanx
stefan

Re: True Random Numbers
Reply #3 - May 13th, 2008, 5:06pm
 
The http://random.irb.hr/ site has a JAVA class you can download and probably just include and use right in Processing. Scroll down to "user-contributed downloads."
Re: True Random Numbers
Reply #4 - May 13th, 2008, 6:39pm
 
Except perhaps for encryption, algorithms like Mersenne Twister are good enough for most uses.
Re: True Random Numbers
Reply #5 - Jun 7th, 2008, 4:48pm
 
Thanx jason and PhiLo,

I've tried to intregrate the Unlekker-Library from Marius Watz trough dropping it in the libraries folder and write in the beginning of the script "import unlekker.util.*;".

I don't really get how to catch the syntax of the library. From the Classes Overview it seems like, it's the same as the original random function of processing.
http://workshop.evolutionzone.com/files/unlekkerLibDoc/

float r = random(0, 5);

Does the lib automatically overwrite the default random or will i need to call it with another syntax, for example: randomUnlekk(0, 5); or something similar.

Thanx for help
Re: True Random Numbers
Reply #6 - Jun 8th, 2008, 12:04am
 
From the JavaDoc of this library, you have to instanciate an object to use it:
Rnd rand = new Rnd();
float rf = rand.random(0f, 5f);
int ri = rand.random(0, 5);
Page Index Toggle Pages: 1