File tree Expand file tree Collapse file tree 2 files changed +4
-3
lines changed Expand file tree Collapse file tree 2 files changed +4
-3
lines changed Original file line number Diff line number Diff line change @@ -70,7 +70,7 @@ public static void main(String[] args) {
70
70
System .out .println ("\n CUSTOM RNG TESTS\n " );
71
71
72
72
SecureRandom rng = new SecureRandom ();
73
- DafnyVMC .Random t = new DafnyVMC .Random (rng );
73
+ DafnyVMC .Random t = new DafnyVMC .Random (() -> rng );
74
74
75
75
System .out .println ("Example of Coin sampling" );
76
76
System .out .println (t .CoinSample ());
Original file line number Diff line number Diff line change 3
3
import dafny .TypeDescriptor ;
4
4
import java .math .BigInteger ;
5
5
import java .security .SecureRandom ;
6
+ import java .util .function .Supplier ;
6
7
7
8
public class Random implements DafnyVMCTrait .RandomTrait {
8
9
static ThreadLocal <SecureRandom > rng ;
@@ -11,8 +12,8 @@ public Random() {
11
12
this .rng = ThreadLocal .withInitial (Random ::createSecureRandom );
12
13
}
13
14
14
- public Random (SecureRandom rng ) {
15
- this .rng = ThreadLocal .withInitial (() -> rng );
15
+ public Random (Supplier < SecureRandom > supplier ) {
16
+ this .rng = ThreadLocal .withInitial (supplier );
16
17
}
17
18
18
19
private static final SecureRandom createSecureRandom () {
You can’t perform that action at this time.
0 commit comments