Some characterizations of the uniform distribution with applications to random number generation