Adi Sudewa schrieb:
> 
> Hi all,
> 
> how to generate random integers from within real-time thread.
> I need to generate random numbers so my simulation can be unpredictable.
> It is not cool to have a train running with 20.00 m/s speed
> all the time so I'd like to have the speed fluctuate round 20.00 m/s.
> 
Here is an extremely simple one (from 
http://www.realtimelinux.org/CRAN/src/rtUtils-v0.1.0.h)

static unsigned long rtseed = 0;
unsigned long rtrand( void ) {
  rtseed = rtseed * 0x41C64E6D + 0x3039;
  return (rtseed>>16)&0x7FFF;
}

Have fun
Wilken
-- [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/

Reply via email to