java generate list of random element

Java
Stream.generate(Element::randomGenerator)
  .limit(length)
  .collect(Collectors.toList());
Source

Also in Java: