Block-Structured AMR Software Framework
AMReX_Random.H File Reference
#include <AMReX_Config.H>
#include <AMReX.H>
#include <AMReX_GpuQualifiers.H>
#include <AMReX_ParallelDescriptor.H>
#include <AMReX_RandomEngine.H>
#include <limits>
#include <cstdint>

Go to the source code of this file.

Namespaces

 amrex
 
 amrex::detail
 

Functions

Real amrex::Random ()
 Generate a psuedo-random double from uniform distribution. More...
 
AMREX_GPU_HOST_DEVICE AMREX_FORCE_INLINE Real amrex::Random (RandomEngine const &random_engine)
 
Real amrex::RandomNormal (Real mean, Real stddev)
 Generate a psuedo-random double from a normal distribution. More...
 
AMREX_GPU_HOST_DEVICE AMREX_FORCE_INLINE Real amrex::RandomNormal (Real mean, Real stddev, RandomEngine const &random_engine)
 
unsigned int amrex::RandomPoisson (Real lambda)
 Generate a psuedo-random integer from a Poisson distribution. More...
 
AMREX_GPU_HOST_DEVICE AMREX_FORCE_INLINE unsigned int amrex::RandomPoisson (Real lambda, RandomEngine const &random_engine)
 
unsigned int amrex::Random_int (unsigned int n)
 Generates one pseudorandom unsigned integer which is uniformly distributed on [0,n-1]-interval for each call. More...
 
AMREX_GPU_HOST_DEVICE AMREX_FORCE_INLINE unsigned int amrex::Random_int (unsigned int n, RandomEngine const &random_engine)
 
ULong amrex::Random_long (ULong n)
 Generates one pseudorandom unsigned long which is uniformly distributed on [0,n-1]-interval for each call. More...
 
void amrex::FillRandom (Real *p, Long N)
 
void amrex::FillRandomNormal (Real *p, Long N, Real mean, Real stddev)
 Fill random numbers from normal distribution. More...
 
ULong amrex::detail::DefaultGpuSeed ()
 
void amrex::InitRandom (ULong cpu_seed, int nprocs=ParallelDescriptor::NProcs(), ULong gpu_seed=detail::DefaultGpuSeed())
 Set the seed of the random number generator. More...
 
void amrex::ResetRandomSeed (ULong cpu_seed, ULong gpu_seed)
 
void amrex::SaveRandomState (std::ostream &os)
 Save and restore random state. More...
 
void amrex::RestoreRandomState (std::istream &is, int nthreads_old, int nstep_old)
 
void amrex::UniqueRandomSubset (Vector< int > &uSet, int setSize, int poolSize, bool printSet=false)
 Create a unique subset of random numbers from a pool of integers in the range [0, poolSize - 1] the set will be in the order they are found setSize must be <= poolSize uSet will be resized to setSize if you want all processors to have the same set, call this on one processor and broadcast the array. More...
 
void amrex::DeallocateRandomSeedDevArray ()