Advertisement

07.22.2008 at 05:03PM PDT, ID: 23586990
[x]
Attachment Details

srand(time(NULL)

Asked by zizi21 in C Programming Language

i am trying to generate random numbers but at times, the numbers are not random..get duplicates i know this means random..

when i put srand(time(NULL)) before the loop, it gets the system time before the program starts ..

but is there a way to change it to take the system time that changes every milisecond or nanosecond.. i have searched the internet..i did not find anything except program time

Start Free Trial
[+][-]07.22.2008 at 05:18PM PDT, ID: 22064944

Assisted solutions are selected by the member who asked the question as a comment that contributed to their question's solution.

Start your 7-day free trial to view this Assisted Solution or ask the Experts your question.

 
[+][-]07.22.2008 at 07:45PM PDT, ID: 22065597

Assisted solutions are selected by the member who asked the question as a comment that contributed to their question's solution.

Start your 7-day free trial to view this Assisted Solution or ask the Experts your question.

 
[+][-]07.22.2008 at 08:37PM PDT, ID: 22065789

View this solution now by starting your 7-day free trial. Setting up your free trial is quick, easy, and secure. We will return you to this solution, unlocked, when you're done.

 

About this solution

Zone: C Programming Language
Sign Up Now!
Solution Provided By: sunnycoder
Participating Experts: 3
Solution Grade: A
 
 
 
Loading Advertisement...
20080716-EE-VQP-32 / EE_QW_2_20070628