Hi all
how do load vars with random values ?
for example I need 3 random integers from 1 to 10 1 in each in each var .
What is the C code for declaring 3 integer variables loaded with a random integer for 1 to 10 each ?
Thanks Elico
I recommend that you try typing "random numbers in C" into a web search engine and look at some of the results. If you have specific problems, come back here and say something like: I tried ... and I got ..., but I expected ...
In J1708 when a collision happens, you add a random delay before you try again.; Once two units communicating via J1708 both using Keil collided, had I not stopped them they would still be colliding, BEWARE the rand function is NOT random it is pseudorandom
Erik
It doesn't hurt to make use of least-significant-bit noise from the ADC, or inter-packet delays on ethernet interface etc, to help out with some extra entropy. rand()/srand() alone can be quite boring to use.
my favorite random generator is a free running timer that is read when some asynchrounous event e.g. a button press happens.