Java LongStream create from random long value
import java.util.Random; import java.util.stream.LongStream; public class Main { public static void main(String[] args) { LongStream.generate(new Random()::nextLong) .limit(10)//from ww w .ja v a 2 s . c om .forEach(System.out::println); } }