Skip to content

Commit

Permalink
Add ability to use SplittableRandom as well as Random
Browse files Browse the repository at this point in the history
  • Loading branch information
pontusmelke committed May 11, 2018
1 parent 1f7b96f commit 8d2e564
Show file tree
Hide file tree
Showing 5 changed files with 235 additions and 49 deletions.
@@ -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();
}
@@ -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();
}
}

0 comments on commit 8d2e564

Please sign in to comment.