Module org.apache.lucene.facet
Package org.apache.lucene.facet
Class RandomSamplingFacetsCollector.XORShift64Random
java.lang.Object
org.apache.lucene.facet.RandomSamplingFacetsCollector.XORShift64Random
- Enclosing class:
RandomSamplingFacetsCollector
Faster alternative for java.util.Random, inspired by
http://dmurphy747.wordpress.com/2011/03/23/xorshift-vs-random- performance-in-java/
Has a period of 2^64-1
-
Field Summary
Fields -
Constructor Summary
ConstructorsConstructorDescriptionXORShift64Random
(long seed) Creates a xorshift random generator using the provided seed -
Method Summary
Modifier and TypeMethodDescriptionint
nextInt
(int n) Get the next random int, between 0 (inclusive) and n (exclusive)long
Get the next random long value
-
Field Details
-
x
private long x
-
-
Constructor Details
-
XORShift64Random
public XORShift64Random(long seed) Creates a xorshift random generator using the provided seed
-
-
Method Details
-
randomLong
public long randomLong()Get the next random long value -
nextInt
public int nextInt(int n) Get the next random int, between 0 (inclusive) and n (exclusive)
-