In my program, I have a function return_random_vector()
which takes a set of numbers, say 1,2,3,4,5
, and returns a random rearrangement of the numbers such as 2,5,1,4,3
.
In order to do this, I set the seed srand(time(NULL))
. For my program, I want to be able to call this function again with 1,2,3,4,5
and get another rearrangement of them, for example 3,1,4,5,2
.
Is there a way I can set srand()
so that the seed can be reset?
Aucun commentaire:
Enregistrer un commentaire