PCL
pcl::XorShift1024 Class Reference

Implementation of the XorShift1024* pseudo-random number generator. More...

#include <Random.h>

Public Member Functions

 XorShift1024 (uint64 seed=0) noexcept(false)
 
void Initialize (uint64 x)
 
double operator() () noexcept
 
uint32 UI32 () noexcept
 
uint32 UI32N (uint32 n) noexcept
 
uint64 UI64 () noexcept
 
uint64 UI64N (uint64 n) noexcept
 
uint32 UIN (uint32 n) noexcept
 

Detailed Description

Deprecated:
This class has been deprecated. Use the XoShiRo256ss and XoRoShiRo1024ss classes for all newly produced code.

Generation of pseudo-random uniform deviates using the xorshift1024* generator developed in 2014 by Sebastiano Vigna. This is a fast, top-quality generator with a period of 2^1024-1, passing strong statistical test suites.

Examples of use:

XorShift1024 X; // initialized automatically
// ...
double x = X(); // x = random uniform deviate in the range [0,1)
uint64 y = X.UI64(); // y = 64-bit unsigned integer random uniform deviate
uint32 z = X.UI32(); // z = 32-bit unsigned integer random uniform deviate
uint32 t = X.UIN( 100 ); // t = integer uniform deviate in the range [0,99]

References

Sebastiano Vigna (2014), An experimental exploration of Marsaglia's xorshift generators, scrambled, arXiv:1402.6246

Sebastiano Vigna (2014), Further scramblings of Marsaglia's xorshift generators, arXiv:1404.0390

See also: http://xorshift.di.unimi.it/

Definition at line 298 of file Random.h.

Constructor & Destructor Documentation

◆ XorShift1024()

pcl::XorShift1024::XorShift1024 ( uint64  seed = 0)
inlinenoexcept

Constructs a XorShift1024 pseudo-random number generator.

Parameters
seed64-bit initialization seed. If this parameter is zero, a unique random seed will be generated automatically. The default value is zero.

Definition at line 309 of file Random.h.

Member Function Documentation

◆ Initialize()

void pcl::XorShift1024::Initialize ( uint64  x)
inline

Reinitializes this generator with a new seed.

If the specified seed is zero, a unique, high-quality random seed will be generated automatically by calling RandomSeed64().

Definition at line 374 of file Random.h.

References pcl::RandomSeed64().

◆ operator()()

double pcl::XorShift1024::operator() ( )
inlinenoexcept

Returns a double precision uniform random deviate in the [0,1) range.

Definition at line 317 of file Random.h.

◆ UI32()

uint32 pcl::XorShift1024::UI32 ( )
inlinenoexcept

Returns a 32-bit unsigned integer uniform random deviate.

Definition at line 338 of file Random.h.

◆ UI32N()

uint32 pcl::XorShift1024::UI32N ( uint32  n)
inlinenoexcept

A synonym for UIN().

Definition at line 363 of file Random.h.

◆ UI64()

uint64 pcl::XorShift1024::UI64 ( )
inlinenoexcept

Returns a 64-bit unsigned integer uniform random deviate.

Definition at line 325 of file Random.h.

◆ UI64N()

uint64 pcl::XorShift1024::UI64N ( uint64  n)
inlinenoexcept

Returns a 64-bit unsigned integer uniform random deviate in the range [0,n-1].

Definition at line 347 of file Random.h.

◆ UIN()

uint32 pcl::XorShift1024::UIN ( uint32  n)
inlinenoexcept

Returns an unsigned integer uniform random deviate in the range [0,n-1].

Definition at line 355 of file Random.h.


The documentation for this class was generated from the following file:
pcl::uint32
unsigned int uint32
Definition: Defs.h:669
pcl::uint64
unsigned long long uint64
Definition: Defs.h:685
pcl::XorShift1024::XorShift1024
XorShift1024(uint64 seed=0) noexcept(false)
Definition: Random.h:309