Random or Pseudo-Random?


#1

Some of you have noticed that the current random function in the Blinks API is not truly entropic or random. It is the C-Library or Arduino’s default implementation of random, allowing for a random seed to be set and give the same set of generated numbers. There are plenty of reasons to want a list of generated numbers that is the same on all Blinks, and there are plenty of reasons to want a random number, like a dice roll.

My gut sense is to update this and provide you with a truly random (based on entropy) number so you can use random like a dice, and if you want a list of generated numbers to be the same on each Blink, it is a function that you create based on your needs…

What value do you think the function random should return?

  • random
  • pseudo-random

0 voters


#2

There are also some compromise solutions, like having the seed for each blink be based on its own unique serial number. In this case, the numbers that random() returns will be still be the same sequence after powerup on each blink, but different blinks will have different sequences.