hi....i'm trying to write a code that generate random numbers quickly because i'll iterate my code a lot of times.....millions of times....
I use srand(time(NULL)) to initialize the seed, and random(RAND_MAX) to generate the random number, but this form is annormally slow
I need help to reduce the time of execution because millions of iterations retard too my program using "random"
Excuse me for my english...thanks!!!
rpg245
0
Newbie Poster
Recommended Answers
Jump to Postcall srand() only once during the lifetime of the program -- normally called near the beginning of main().
All 4 Replies
Ancient Dragon
5,243
Achieved Level 70
Team Colleague
Featured Poster
rpg245
0
Newbie Poster
ArkM
1,090
Postaholic
Salem
5,138
Posting Sage
Be a part of the DaniWeb community
We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.