Click here to Skip to main content
15,918,889 members
Home / Discussions / C / C++ / MFC
   

C / C++ / MFC

 
GeneralRe: read from file Pin
Jamie Hale28-Jan-02 5:05
Jamie Hale28-Jan-02 5:05 
GeneralRe: read from file Pin
Christian Graus28-Jan-02 8:44
protectorChristian Graus28-Jan-02 8:44 
GeneralInstalling a callback between two applications Pin
Mr.Freeze27-Jan-02 15:52
Mr.Freeze27-Jan-02 15:52 
GeneralRe: Installing a callback between two applications Pin
27-Jan-02 16:09
suss27-Jan-02 16:09 
GeneralRe: Installing a callback between two applications Pin
Mr.Freeze27-Jan-02 17:47
Mr.Freeze27-Jan-02 17:47 
GeneralRe: Installing a callback between two applications Pin
27-Jan-02 18:39
suss27-Jan-02 18:39 
Generalread from file Pin
marouane miftah el kheir27-Jan-02 15:27
marouane miftah el kheir27-Jan-02 15:27 
GeneralRandom Numbers :: C++ Pin
valikac27-Jan-02 15:00
valikac27-Jan-02 15:00 
Hi.
I am experience recursive random number. It seems that only happens when rand() is in a loop.

For example:

--------------------------------------
srand(time(0));
int tempNUM = 0;

for (int i = 0; i < 1000; ++i)
{
tempNUM = 1 + rand() %9999999;
cout << tempNUM + 1;
}
--------------------------------------

In a program I am working on with a similar code to the one above, the program generates duplicates random numbers. It seems I have to *wait* one second clock until it generates a something new. Does that have something to do with time(0)?

I would like something that can generate a completely random number almost instantaneously even when it is in a for loop like the one above.

Thanks,
Kuphryn
GeneralRe: Random Numbers :: C++ Pin
Michael Dunn27-Jan-02 17:22
sitebuilderMichael Dunn27-Jan-02 17:22 
GeneralRe: Random Numbers :: C++ Pin
markkuk27-Jan-02 19:44
markkuk27-Jan-02 19:44 
GeneralRe: Random Numbers :: C++ Pin
valikac28-Jan-02 4:37
valikac28-Jan-02 4:37 
GeneralHelp with Win32, but its in the VB forum Pin
David Wengier27-Jan-02 14:53
David Wengier27-Jan-02 14:53 
Generalplease help me this is urgent Pin
borland27-Jan-02 14:50
borland27-Jan-02 14:50 
GeneralRe: please help me this is urgent Pin
27-Jan-02 15:13
suss27-Jan-02 15:13 
GeneralRe: please help me this is urgent Pin
Michael Dunn27-Jan-02 17:19
sitebuilderMichael Dunn27-Jan-02 17:19 
Questioninput reading? Pin
marouane miftah el kheir27-Jan-02 13:00
marouane miftah el kheir27-Jan-02 13:00 
AnswerRe: input reading? Pin
borland27-Jan-02 14:52
borland27-Jan-02 14:52 
Questionreturning arrays? Pin
marouane miftah el kheir27-Jan-02 11:18
marouane miftah el kheir27-Jan-02 11:18 
AnswerRe: returning arrays? Pin
Matt Gullett27-Jan-02 11:25
Matt Gullett27-Jan-02 11:25 
GeneralRe: returning arrays? Pin
Nemanja Trifunovic27-Jan-02 12:12
Nemanja Trifunovic27-Jan-02 12:12 
GeneralRe: returning arrays? Pin
Matt Gullett27-Jan-02 12:27
Matt Gullett27-Jan-02 12:27 
GeneralRe: returning arrays? Pin
alex.barylski27-Jan-02 19:56
alex.barylski27-Jan-02 19:56 
QuestionHow to move/copy a file!? Pin
Rickard Andersson2027-Jan-02 10:43
Rickard Andersson2027-Jan-02 10:43 
AnswerRe: How to move/copy a file!? Pin
Matt Gullett27-Jan-02 10:56
Matt Gullett27-Jan-02 10:56 
AnswerRe: How to move/copy a file!? Pin
Vladimir Georgiev27-Jan-02 12:51
Vladimir Georgiev27-Jan-02 12:51 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.