a yet another solution(for different granularity of generation time) wherein a unique random number can be generated more than once within a second......

struct timeval tv;
gettimeofday(&tv, NULL);
srandom((tv.tv_sec<<16)|(tv.tv_usec>>16));
uniquenum = random();

rgds,
Rahul

Manish Jethani wrote:

Seed it using srandom((unsigned) time(NULL)) before any calls to random().

-Manish

--
Rahul Arvind Jadhav
Software Engineer, NetYantra India Pvt. Ltd, Mumbai,
Resi. Tel:      +91 (22) 24187814
Off. Tel:       +91 (22) 27672547/49 27682624 Ext. 233
Web:            http://rahuljadhav.tripod.com
Company:        www.netyantra.com




--



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

Reply via email to