Skip to content

Instantly share code, notes, and snippets.

@TGITS
Last active February 5, 2022 14:50
Show Gist options
  • Save TGITS/d0948f4b408393c2898ed2c84e1fac2b to your computer and use it in GitHub Desktop.
Save TGITS/d0948f4b408393c2898ed2c84e1fac2b to your computer and use it in GitHub Desktop.
Utilisation de RandomGeneratorFactory pour afficher les différents algorithmes de génération de nombres aléatoires disponibles
import java.util.random.RandomGeneratorFactory;
var template = "Algorithm name : %s - group : %s - characteristics : {%s%s%s%s%s%s%s%s stateBits: %d }";
var algorithms = RandomGeneratorFactory.all().map(
factory -> template.formatted(
factory.name(),
factory.group(),
factory.isSplittable() ? " splittable" : "",
factory.isStreamable() ? " streamable" : "",
factory.isJumpable() ? " jumpable" : "",
factory.isArbitrarilyJumpable() ? " arbitrary-jumpable" : "",
factory.isLeapable() ? " leapable" : "",
factory.isHardware() ? " hardware" : "",
factory.isStatistical() ? " statistical" : "",
factory.isStochastic() ? " stochastic" : "",
factory.stateBits())).sorted().collect(Collectors.joining("\n"));
System.out.println(algorithms);
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment