[Date Prev][Date Next]
[Chronological]
[Thread]
[Top]
Re: [rtl] Random?
>>>>> "Zennaro" == Zennaro Marco <zennaro@ictp.trieste.it> writes:
Zennaro> Hi! I have a problem (small one..). I have to generate a
Zennaro> random number in a RTLinux module. I cannot use rand(). How
Zennaro> can I generate the number?
Why not use rand()?
I assume you mean pseudo-random... You could just lift one of the
generators from Knuth volume 2. For example:
static unsigned long seed = 1;
unsigned long ulrand (void)
{
return (seed *= 69069);
}
paul
--- [rtl] ---
To unsubscribe:
echo "unsubscribe rtl" | mail majordomo@rtlinux.cs.nmt.edu OR
echo "unsubscribe rtl <Your_email>" | mail majordomo@rtlinux.cs.nmt.edu
----
For more information on Real-Time Linux see:
http://www.rtlinux.org/~rtlinux/