If you need to generate a random number between two (2) numbers in Python, then you can make use of the random module.

First, import the module:

1
import random

Then you can use it like this:

1
random.randint(0, 255)

Another option is to use randrange and uniform as follows:

1
2
3
4
5
6
7
from random import randrange, uniform

# randrange gives you an integral value
irand = randrange(0, 10)

# uniform gives you a floating-point value
frand = uniform(0, 10)