implementation of random using lazy seq