Block-Structured AMR Software Framework
AMReX_Random.cpp File Reference
#include <AMReX_Arena.H>
#include <AMReX_BLFort.H>
#include <AMReX_Print.H>
#include <AMReX_Random.H>
#include <AMReX_Gpu.H>
#include <AMReX_OpenMP.H>
#include <set>
#include <random>
#include <limits>

Namespaces

 amrex
 

Functions

void amrex::InitRandom (ULong cpu_seed, int nprocs=ParallelDescriptor::NProcs(), ULong gpu_seed=detail::DefaultGpuSeed())
 Set the seed of the random number generator. More...
 
Real amrex::RandomNormal (Real mean, Real stddev)
 Generate a psuedo-random double from a normal distribution. More...
 
Real amrex::Random ()
 Generate a psuedo-random double from uniform distribution. More...
 
unsigned int amrex::RandomPoisson (Real lambda)
 Generate a psuedo-random integer from a Poisson distribution. More...
 
Real amrex::RandomGamma (Real alpha, Real beta)
 Generate a psuedo-random floating point number from the Gamma distribution. More...
 
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...
 
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::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::ResetRandomSeed (ULong cpu_seed, ULong gpu_seed)
 
void amrex::DeallocateRandomSeedDevArray ()
 
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...
 
double amrex_random ()
 
amrex::Long amrex_random_int (amrex::Long n)
 

Variables

amrex::randState_tamrex::gpu_rand_state = nullptr
 

Function Documentation

◆ amrex_random()

double amrex_random ( )

◆ amrex_random_int()

amrex::Long amrex_random_int ( amrex::Long  n)