Nikhil, the term RNG is actually a misnormer the numbers that a RNG generates
are actually pseudo random numbers, meaning they are reproducible and the
generating function is known(hence they can be reproduced).
Most of the RNG's we know of are LCG's(Linear Congruential Generators)
They work on a simple recurrence relation
r(i+1) = (A * r(i) ) MOD m
MOD is the modulus operator.
In ur case
Considering that r(i), A and m are constant r(i+1) will also be the same each
time u execute the program.
A clever workaround will be calling srand() with the seed as the current
system time.
The ideal generators are those that have a period equal to 'm'.
The period is the longest possible non-overlapping sequence of numbers
generated by a LCG.
the greater the period the more desirable is the generator(but the sequence
of numbers generated is also important).
The 'seed' is nothing but r(0) ie the first r on the RHS of the recurrence
relation.
The C library RNG is not that good in the sense that it has failed many
theoretical and empirical tests.
there are a lot of RNG'S that are much better than this generator and have
whopping periods.They also provide the user with the ability to generate
disjoint substreams of numbers using the same generator.
Random number generation is a tricky process and needs a lot of mathematical
intuition.
And finally if you are looking for truly random numbers try weather data from
internet weather stations.These are truly random.
For a more thorough understanding read Knuth:Art of computer programming.
Enjoy!!
Sankha
--
SANKHA SUBHRA SOM
ATC - BIOINFORMATICS
TCS
KLK BUILDING.
HYDERABAD-1
Ph:(040)6787980-1024
********************************************************
An anonymous digitoid
********************************************************
The world is populated in the main by people who should not exist.