16 lines
514 B
Java
16 lines
514 B
Java
// interfaces/RandVals.java
|
|
// (c)2020 MindView LLC: see Copyright.txt
|
|
// We make no guarantees that this code is fit for any purpose.
|
|
// Visit http://OnJava8.com for more book information.
|
|
// Initializing interface fields with
|
|
// non-constant initializers
|
|
import java.util.*;
|
|
|
|
public interface RandVals {
|
|
Random RAND = new Random(47);
|
|
int RANDOM_INT = RAND.nextInt(10);
|
|
long RANDOM_LONG = RAND.nextLong() * 10;
|
|
float RANDOM_FLOAT = RAND.nextLong() * 10;
|
|
double RANDOM_DOUBLE = RAND.nextDouble() * 10;
|
|
}
|