From: Herbert Kleebauer on 26 Aug 2007 12:53 santosh wrote:> > Herbert Kleebauer wrote: > > - Does Linux provide a random number? Had to use the time > > as a workaround. > > Yes just read from /dev/random and/or /dev/urandom. Looks a bit overcomplicated. Does /dev/random exist on any Linux?
From: Robert Redelmeier on 26 Aug 2007 13:01 Herbert Kleebauer <klee(a)unibwm.de> wrote in part: > santosh wrote:> >> Yes just read from /dev/random and/or /dev/urandom. > > Looks a bit overcomplicated. Does /dev/random exist on > any Linux? Yes, the devices are part of the kernel. The links in /dev might be removed , but that's brain-damage. /dev/random will block if there isn't enough entropy available in the kernel. (MS-Win probably has more :) /dev/urandom will run a PRNG. man 4 random -- Robert
From: santosh on 26 Aug 2007 14:05 Herbert Kleebauer wrote: > santosh wrote:> >> Herbert Kleebauer wrote: > >> > - Does Linux provide a random number? Had to use the time >> > as a workaround. >> >> Yes just read from /dev/random and/or /dev/urandom. > > Looks a bit overcomplicated. Does /dev/random exist on any > Linux? On all modern versions, yes. A read from /dev/random blocks until sufficiently entropic bits are available, while /dev/urandom returns immediately, with possibly inferior randomness. Also the /proc/sys/kernel/random is linked to /dev/random. See man 4 random. But what is wrong with the C standard library rand()?
From: rhyde on 26 Aug 2007 15:01 On Aug 26, 11:05 am, santosh <santosh....(a)gmail.com> wrote: .. > > But what is wrong with the C standard library rand()? Try posting that to comp.lang.c and be prepared for the flames you'll get. The C stdlib rand() function is a well-known poor example of a random number generator. Then again, if you don't care about "good randomness", it's probably fine. hLater, Randy Hyde
From: Wolfgang Kern on 26 Aug 2007 15:50
Herbert Kleebauer wrote: > Just converted the Erde graphics demo to Linux. Maybe somebody can try it > (use the mouse to fly, press any key or button to exit). The source in a > follow up. You can find the DOS and Windows version here: > ftp://137.193.64.130/pub/assembler/erde.zip A funny one KB code example, it runs at windoze 98se/XPhome and the com-file runs without problems in full screen mode under the very restricted KESYS DOS-emulator. __ wolfgang |