Gurpreet Singh wrote:
i am working on a project where i need to generate random nos, lots of them.
Just say yes, yes, yes, no, yes, no, yes, yes, no, no, yes... make sure there's no easy pattern to it. Repeat several times till you have enough random nos.
now til now i've been using the random() functio in C, but the thing is
Ok, I get the idea. Use rand() instead, for portability. And you have to seed the random no. generator with, say, the current time. Seed it using srandom((unsigned) time(NULL)) before any calls to random().
i have an idea, rather two
<snip>
or does someone have a better idea of generating random nos?
Yes, read the manual for random(3), srandom(3), rand(3), etc.
-Manish