Hi!
i've taken this code straight from man rand
it is supposed to generate random number between 1 and 10

j=1+(int) (10.0*rand()/(RAND_MAX+1.0));

now when I print j it *always* gives 9

i don't think this is random

i guess it has something to do with seed (what is it anywayz ?)
when i call srand with different seed value it gives some other integer,
but again it *always* gives that integer only..

thx
--
Nikhil Joshi





_______________________________________________
http://mm.ilug-bom.org.in/mailman/listinfo/linuxers

Reply via email to