Skip to content

Commit 0aefb3d

Browse files
committed
Show how to set seed.
1 parent 499ab94 commit 0aefb3d

File tree

2 files changed

+4
-0
lines changed

2 files changed

+4
-0
lines changed

README.md

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -23,6 +23,8 @@ public class RMathDemo {
2323
int lowerTail = 1;
2424
int useLog = 0;
2525

26+
rmath.set_seed((int)System.currentTimeMillis(), 0);
27+
2628
System.out.printf("Drew standard normal random covariate %f\n", rmath.rnorm(0.0, 1.0));
2729
double gd = rmath.rgamma(shape, scale);
2830
System.out.printf("Drew gamma random variate %f\n", gd);

src/main/java/xyz/lejon/r/runnables/RMathDemo.java

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,8 @@ public static void main(String[] args) {
1212
int lowerTail = 1;
1313
int useLog = 0;
1414

15+
rmath.set_seed((int)System.currentTimeMillis(), 0);
16+
1517
System.out.printf("Drew standard normal random covariate %f\n", rmath.rnorm(0.0, 1.0));
1618
double gd = rmath.rgamma(shape, scale);
1719
System.out.printf("Drew gamma random variate %f\n", gd);

0 commit comments

Comments
 (0)