mercredi 8 juin 2016

How to Store srand() value in a variable in c/c++ ? is it possbile at all? [on hold]

I want to generated random numbers without generating any number twice within a range. Such that within the range 0 to N, all possible values will appear only once.

I know how to generate and print them but what I don't know is how to store them in an integer variable so that I can use them when I need them.

I tried the following ways but it didn't work.

int n= srand(time(NULL))

or

int n=srand(time(0))




Aucun commentaire:

Enregistrer un commentaire