0%
0%

# Trinket Randomizer

A random number generator created using the Pro Trinket

Similar projects worth following
1.6k views
Hackaday's Trinket Everday carry contest needed a random number generator for it's weekly drawings. Our first week we used Random.io. Now we've moved onto the pro trinket platform, in what will become a pocketable random number generator.

This project simply needs to generate a random number. It is supplied with a Minimum and Maximum value, and chooses a random number between them. Technically I don't even need the minimum - it's always 1!

To pick a winner, I export the Trinket Everyday Carry contest entries to a spreadsheet. Each entry gets a row. Choose a random row number, and you have a winner!

• 1 × Pro Trinket 3.3V Adafruit's Trinket board
• 1 × FTDI cable Generic FTDI cable for serial comms with the trinket

• ### In the beginning...

I really thought the trinket contest should use a trinket for the weekly random drawings. The first drawing used http://www.random.org/ for a random number. This week, in true Hackaday style, I knocked up a trinket random number generator in about an hour. (That includes soldering the headers on!)

I used the arduino libraries pseudo random number generator. To keep things really random, I generated the random seed from millis() (number of milliseconds since the Arduino/Trinket was powered up)

Share

## Discussions

Hacker404 wrote 12/13/2014 at 11:38 point
LoL, After re-reading that the correct answer is 50. So you were closer that I was.

Are you sure? yes | no

Hacker404 wrote 12/11/2014 at 23:54 point
The thing about pseudo-random is that it is NOT random and hence the 'pseudo'. But if you are using a human (the delay in pressing the button) as the input entropy and that input entropy is greater (a significant multiple of) the selection permutations (number of entries) then all is good.

Keep in mind that because of the looping feature of your code that the input entropy must be divided by the loop frequency. For example; if you poll the button every 20mS then a 1000mS period has a entropy of 200 and not 1000.

Micro controllers cannot generate random numbers period. If they could then you would be able to write a formula for 'random' which because it is coded, would be predictable. The definition of random is 'unpredictable'.

I haven't looked at the library that you are using but I suspect that it may be software implementation of a linear feedback shift register. Check the entropy specifications as these types of pseudo-random generators have a very short sequence repeat period. If the sequence repeat period is NOT orders of magnitude bigger than the permutations then you are NOT being fair to some competitors as their particular permutation may be excluded.

Are you sure? yes | no

PointyOintment wrote 12/13/2014 at 10:40 point
You mean 500?

Are you sure? yes | no

Eric Hertz wrote 12/18/2014 at 07:48 point
You could always throw in the ADC value on an "antenna" attached to a roughly floating pin...

Are you sure? yes | no

## Similar Projects

Project Owner Contributor

### Bitwise Calculator

Boris Shabanov

Project Owner Contributor

### Accelerated Dice

Ford Sleeman

Project Owner Contributor

### Afforestation of barren land using Quadcopter

Goutham

Project Owner Contributor

Michael Wessel

# Does this project spark your interest?

Become a member to follow this project and never miss any updates