(rand() % (b - a)) + a;
random.randint(a, b)
This is no longer uniform, because it introduces a bias towards small numbers.