I want a random number between 0 and 1, like 0.3452
random.random() is what you are looking for:
From python docs:
random.random() Return the next random floating point number in the
range [0.0, 1.0).
And, btw, Why your try didn't work?:
Your try was: random.randrange(0, 1)
From python docs:
random.randrange() Return a randomly selected element from range(start, stop, step). This is equivalent to choice(range(start, stop, step)), but doesn’t actually build a range object.
So, what you are doing here, with random.randrange(a,b) is choosing a random element from range(a,b); in your case, from range(0,1), but, guess what!: the only element in range(0,1), is 0, so, the only element you can choose from range(0,1), is 0; that's why you were always getting 0 back.