So, I have to generate a int vector of length N in which only n casual elements are 1, the others are 0. In order to do this, I created a vector of length N, initialized it so that the first n elements are 1 and the others are 0, and then started to shuffle it with a simple function which takes a vector of int, generates random numbers from 0 to N and reshuffles the vector following the output of rand. My question is: how many times can I "trust" the random generator to give me different sequences of numbers so that I can get every time a different vector? If I run this function, let's say, 1 million times, do I obtain 1 million different combinations (provided that there are more than 1m different ways to reorder my vector)? If not, how should I proceed? There's someway to check whether or not I'm generating a sequence that has been previously generated?
Aucun commentaire:
Enregistrer un commentaire