Kay-Ulrich,
You asked about a random number generator. Here's one I use, in random.h
and random.c:
----------random.h-----------
/*
This random number generator is exactly the one described in
"Random Number Generators: Good Ones are Hard to Find,"
Stephen K. Park and Keith W. Miller, Communications of the ACM,
Volume 31, Number 10, October 1988.
This generator is proposed as the "minimal standard" that will port
to all systems where the maximum integer size is 2^32 - 1 or larger.
*/
#ifndef RANDOM_H
#define RANDOM_H
#define MODULUS 2147483647
extern long int random();
extern long int srandom(long int s);
#endif
--------------end random.h------------
-------------random.c------------
#include "random.h"
#define A 16807
#define Q 127773
#define R 2836
static long int seed = 65521;
long int random()
{
long int lo, hi, test;
hi = seed / Q;
lo = seed % Q;
test = A * lo - R * hi;
if (test > 0)
seed = test;
else
seed = test + MODULUS;
return seed;
}
long int srandom(long int s)
{
return seed = s % MODULUS;
}
-----------end random.c-----------
--Fred
--- [rtl] ---
To unsubscribe:
echo "unsubscribe rtl" | mail [EMAIL PROTECTED] OR
echo "unsubscribe rtl <Your_email>" | mail [EMAIL PROTECTED]
----
For more information on Real-Time Linux see:
http://www.rtlinux.org/~rtlinux/