How do I make device appear to be random?

General project help for Adafruit customers

Moderators: adafruit_support_bill, adafruit

Please be positive and constructive with your questions and comments.
Locked
clayfold
 
Posts: 1
Joined: Sun Feb 14, 2010 3:44 pm

How do I make device appear to be random?

Post by clayfold »

I am starting to make some simple vibrobot kinetic sculptures but I want them to appear to start and stop randomly. Is there a simple way to do this?

Entropy
 
Posts: 472
Joined: Tue Jan 08, 2008 12:43 am

Re: How do I make device appear to be random?

Post by Entropy »

If they're controlled by a microcontroller (ATTiny85 maybe?) - http://www.nongnu.org/avr-libc/user-man ... 87c36654d1

User avatar
adafruit_support_bill
 
Posts: 88154
Joined: Sat Feb 07, 2009 10:11 am

Re: How do I make device appear to be random?

Post by adafruit_support_bill »

Another source of randomness is to just read from an unconnected analog input.

Entropy
 
Posts: 472
Joined: Tue Jan 08, 2008 12:43 am

Re: How do I make device appear to be random?

Post by Entropy »

arduwino wrote:Another source of randomness is to just read from an unconnected analog input.
There's some entropy there but not much.

That would be a decent way to seed a PRNG though, although I don't think the OP requires true random numbers, just something "random looking" for an art exhibit.

User avatar
fazjaxton
 
Posts: 59
Joined: Mon Sep 28, 2009 2:18 pm

Re: How do I make device appear to be random?

Post by fazjaxton »

I think the LSB from A/D conversions is considered to be pretty random, especially if you have 10-12 bits. It's basically electrical noise. If you did 8 conversions and used the 8 LSBs for your seed (or whatever your word size is), that should be pretty random. I would also think that if you set your Vref to be something small like 0.5V, so that each A/D count represents a tiny voltage, it would be more fickle and thus more random.

naxxtor
 
Posts: 13
Joined: Tue Apr 08, 2008 7:42 am

Re: How do I make device appear to be random?

Post by naxxtor »

Depends how random it needs to be. By the sounds of it, it doesn't need to be BANNED-standard random.

http://www.cryogenius.com/hardware/rng/

Something along those lines would be fine if you didn't want to use a PRNG implemented on a micro. Also, as a tip - if you seed the random number once and save it in EEPROM, you'll get the most out of the sequence length. Also, if you were using a micro, you can make the sequence length of the PRNG longer by implementing your own - this would take much more effort though!

pm6041141
 
Posts: 79
Joined: Thu May 29, 2008 5:26 pm

Re: How do I make device appear to be random?

Post by pm6041141 »

You could use a reversed biased NPN transistor and sample the avalanche noise like I did in this project http://petemills.blogspot.com/2010/02/t ... -lamp.html. I also applied what is known as a Von Neumann filter. This is "true" randomness and no ADC is required.

Locked
Please be positive and constructive with your questions and comments.

Return to “General Project help”