How do I generate a 5 digit number that does not repeat (unique)?
public int number;
// Update is called once per frame
void Update () {
if(Input.GetKeyDown(KeyCode.A))
{
num = Random.Range(10000,99999);
}
}
Although a similar question was asked previously, I do not believe it is a duplicate. I am trying to generate a unique random number, instead of 2 numbers repeating.
Aucun commentaire:
Enregistrer un commentaire