Implemented randomStream and unfold