[chuck-users] easy random numbers

Kassen signal.automatique at gmail.com
Mon Nov 19 13:54:20 EST 2007


On 19/11/2007, jakob kaiser <jakobala at hotmail.com> wrote:


Is there an easy way to get something more unpredictable? I don't want to go
> deep into random generator programming. But the function does not really
> what you would expect of a random generator, does it?
>


How about amping up your ADC by lots&lots, casting to int and using that as
a seed? Performance will depend on the bit-depth compared to quality of the
analogue part of the ADC (I'm seeing very "good" results on the phono
pre-amp of my EMU if I leave it open....).

What you could also do is start a very fast counter at the start of your
program and ask the user to hit the space-bar to stop it, then use the
resultant value as a seed.

Not matter how deep you get into random number generators, if you want to
get around your current problem you will have to come up with some way to
get a seed that's not the same every time the program runs, once you get
that the default one should be fine. Random number generators aren't very
hard to implement anyway, at least not as long as you don't have and secret
service agencies chasing you ;¬)

Yours,
Kas.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.cs.princeton.edu/pipermail/chuck-users/attachments/20071119/e33c5c35/attachment.htm 


More information about the chuck-users mailing list