How do I get a random number in Python, the randint doesn’t work, even with import and I can’t seem to find any other way, is there a way I can get a random number from 0 to 2 in Python here?
import random
def randint(minInt, maxInt):
return random.random() * (maxInt - minInt) + minInt
should work
2 Likes
thanks, how funny is it that i battled you several times in the arena competition thingy and lost at all.
and also for the minInt and maxInt, are those variables or args, i don’t specialize in python, but in js
minint is something like this:
import random
def randint(minInt, maxInt):
return random.random() * (maxInt #something like 0 or 1
- minInt #something like 10 or 30) + minInt
Args, same, I’m also better at js :]
1 Like
Yeah, but they were asking if they were variables or args, not what they would be