Hey guys, how would i create a random number to decide whether it should enqueue the customer or not. thank you.

Recommended Answers

All 5 Replies

nvm

srand(time(NULL)); //seed
int lino = rand();    //rand number
srand(time(NULL)); //seed
int lino = rand();    //rand number

To use these functions you must #include <cstdlib>

why we should use---> srand(time(NULL));

for me rand(), always generate same number but why???

Well

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.