Skip to content

Instantly share code, notes, and snippets.

@YShow
Created January 8, 2022 21:59
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save YShow/da678561419cda8e32fccf3a27a649d4 to your computer and use it in GitHub Desktop.
Save YShow/da678561419cda8e32fccf3a27a649d4 to your computer and use it in GitHub Desktop.
jshell> import java.util.*
jshell> import java.util.random.*
jshell> import java.math.*
jshell> Random rand = RandomGenerator.getDefault().asRandom()
rand ==> jdk.internal.util.random.RandomWrapper@1963006a
jshell> List<Integer> intList = Arrays.asList(3,2,1,9,0,4,6,5)
intList ==> [3, 2, 1, 9, 0, 4, 6, 5]
jshell> Collections.shuffle(intList,rand)
jshell> intList.forEach(System.out::print)
16304952
jshell> new BigInteger(32,rand)
$22 ==> 356275378
jshell> new BigInteger(32,rand)
$23 ==> 674085345
jshell> BigInteger.probablePrime(32,rand)
$24 ==> 2791255457
jshell> BigInteger.probablePrime(32,rand)
$25 ==> 3318616813
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment