예제 #1
0
 private static TailCall<Tuple<List<Double>, RNG>> doublesHelper(
     int count, RNG rng, List<Double> xs) {
   Tuple<Double, RNG> t1 = doubleRnd(rng);
   return TailCall.sus(() -> doubles(count - 1, t1._2, xs.cons(t1._1)));
 }
예제 #2
0
 private static TailCall<Tuple<List<Integer>, RNG>> ints2Helper(
     int count, RNG rng, List<Integer> xs) {
   Tuple<Integer, RNG> t1 = rng.nextInt();
   return TailCall.sus(() -> ints2(count - 1, t1._2, xs.cons(t1._1)));
 }
예제 #3
0
 private static TailCall<Tuple<List<Double>, RNG>> doubles(int count, RNG rng, List<Double> xs) {
   return count == 0 ? TailCall.ret(new Tuple<>(xs, rng)) : doublesHelper(count, rng, xs);
 }
예제 #4
0
 private static TailCall<Tuple<List<Integer>, RNG>> ints2(int count, RNG rng, List<Integer> xs) {
   return count == 0 ? TailCall.ret(new Tuple<>(xs, rng)) : ints2Helper(count, rng, xs);
 }