PyNE C++
Public Member Functions | Public Attributes | List of all members
pyne::AliasTable Class Reference

A data structure for O(1) source sampling. More...

#include <source_sampling.h>

Public Member Functions

 AliasTable (std::vector< double > p)
 
int sample_pdf (double rand1, double rand2)
 

Public Attributes

int n
 
std::vector< double > prob
 Number of bins in the PDF.
 
std::vector< int > alias
 Probabilities.
 

Detailed Description

A data structure for O(1) source sampling.

Constructor & Destructor Documentation

◆ AliasTable()

pyne::AliasTable::AliasTable ( std::vector< double >  p)

Constructor

Parameters
pA normalized probability distribution function

Member Function Documentation

◆ sample_pdf()

int pyne::AliasTable::sample_pdf ( double  rand1,
double  rand2 
)

Samples the alias table

Parameters
rand1A random number in range [0, 1].
rand2A random number in range [0, 1].

The documentation for this class was generated from the following files: