Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add ability to use SplittableRandom as well as Random
- Loading branch information
1 parent
1f7b96f
commit 8d2e564
Showing
5 changed files
with
235 additions
and
49 deletions.
There are no files selected for viewing
16 changes: 16 additions & 0 deletions
16
community/random-values/src/main/java/org/neo4j/values/Generator.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Original file line | Diff line number | Diff line change |
---|---|---|---|
@@ -0,0 +1,16 @@ | |||
package org.neo4j.values; | |||
|
|||
public interface Generator | |||
{ | |||
long nextLong(); | |||
|
|||
boolean nextBoolean(); | |||
|
|||
int nextInt(); | |||
|
|||
int nextInt( int bound ); | |||
|
|||
float nextFloat(); | |||
|
|||
double nextDouble(); | |||
} |
49 changes: 49 additions & 0 deletions
49
community/random-values/src/main/java/org/neo4j/values/RandomGenerator.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Original file line | Diff line number | Diff line change |
---|---|---|---|
@@ -0,0 +1,49 @@ | |||
package org.neo4j.values; | |||
|
|||
import java.util.Random; | |||
|
|||
public class RandomGenerator implements Generator | |||
{ | |||
private final Random random; | |||
|
|||
public RandomGenerator( Random random ) | |||
{ | |||
this.random = random; | |||
} | |||
|
|||
@Override | |||
public long nextLong() | |||
{ | |||
return random.nextLong(); | |||
} | |||
|
|||
@Override | |||
public boolean nextBoolean() | |||
{ | |||
return random.nextBoolean(); | |||
} | |||
|
|||
@Override | |||
public int nextInt() | |||
{ | |||
return random.nextInt(); | |||
} | |||
|
|||
@Override | |||
public int nextInt( int bound ) | |||
{ | |||
return random.nextInt( bound ); | |||
} | |||
|
|||
@Override | |||
public float nextFloat() | |||
{ | |||
return random.nextFloat(); | |||
} | |||
|
|||
@Override | |||
public double nextDouble() | |||
{ | |||
return random.nextDouble(); | |||
} | |||
} |
Oops, something went wrong.