Implementation of random variables