jeudi 4 février 2016

Using rand() to generate a number without digit duplicates

How can we customize the code with rand() function in order to generate a n-digit number, where n<8, without digit duplicates in it? Suppose I want to generate a 4 digit number from 1000 to 9999, this number should not contain digit duplicates: for instance 1023 4798, etc. Btw, we may not generalize n.




Aucun commentaire:

Enregistrer un commentaire