Go Down

Topic: Re: Random() (Read 1 time) previous topic - next topic

dhenry

Looks pretty random to me.

Graynomad

Yes it does. I used analogRead() IIRC, interesting difference I wonder why. Maybe the /16 div factor you're using, They seem to use 2.

_____
Rob
Rob Gray aka the GRAYnomad www.robgray.com

Coding Badly

google rand() srand().  The approach I outlined will provide a truly random number.


No, it doesn't.  Using your function, I get a steady stream of...

Code: [Select]
1023
1023
1023
1023
1023
1023
1023
...
1023


I'll give you a hint, @dhenry, making a claim that something provides "truly random numbers" requires a mathematical proof.  Posting a single function with one person's casual observations is not even close.

dhenry

With the stock analogRead(), here are the top value counts after about 2500*8 samples:

Code: [Select]

value  count
0 107
84 96
42 89
21 89
10 81
64 79
80 78
8 78
85 77
2 77


dhenry

Quote
Maybe the /16 div factor you're using,


That's not done without reason, :)

Quote
They seem to use 2.


:)

Go Up