hi everyone how to generate random codes given to the computer if i give
three codes example : 123,234,567
i need to output anyone of these at a time
Put it into a vector, then randon shiffle it, and get the first element. Here is an
example:
int doIt(){
declare std::vector<int> variable;
while input.isgood, put input into variable.
call std::random_shuffle with variable;
print variable[0], a random number from the list of inputs given.
}
You could certainly do what firstPerson has suggested. Or you could just generate independent random numbers: http://programmingexamples.net/index.php?title=CPP/RandomNumbers
We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.