[Date Prev][Date Next] [Thread Prev][Thread Next] [Date Index] [Thread Index]

Re: Random.h



On Mon, Jul 28, 2003 at 11:59:37AM +0200, Nils-Erik Svang?rd wrote:
> I'm trying to
> #include <linux/random.h>
> because I've read somewhere that if I need very good random numbers in
                    ^^^^^^^^^

Where?

> linux thats the way to go.
> But when I include it and try to compile I get:
> $gcc -lgmp prim_med_gmp.c
> /tmp/ccgB8Uh9.o(.text+0x15b): In function `main':
> : odefined reference to "get_random_bytes"
> collect2: ld returned 1 exit status

You're not supposed to include kernel headers like <linux/random.h> from
userspace code.

Have you tried just using the libc's rand() function? If that's too
pseudo-random for you, you could read from /dev/random instead. See the
random(4) man page.

Cheers,

-- 
Colin Watson                                  [cjwatson@flatline.org.uk]



Reply to: