firstrandom = random.randint(1,2)
secondrandom = random.randint(1,2)
I just need the secondrandom variable to not equal the firstrandom variable, but I don't know how to.
firstrandom = random.randint(1,2)
secondrandom = random.randint(1,2)
I just need the secondrandom variable to not equal the firstrandom variable, but I don't know how to.
Some potential options:
1 or 2, just make secondrandom = 1 + (firstrandom % 2).randint in a loop and only exit the loop when the value is different from firstrandom.random.sample of the allowed values.You can use this method:
secondrandom = firstrandom
while firstrandom == secondrandom: secondrandom = random.randint(1,2)