QuantLib: a free/open-source library for quantitative finance
fully annotated source code - version 1.34
Loading...
Searching...
No Matches
Public Types | Public Member Functions | Private Attributes | List of all members
RandomSequenceGenerator< RNG > Class Template Reference

Random sequence generator based on a pseudo-random number generator. More...

#include <randomsequencegenerator.hpp>

+ Inheritance diagram for RandomSequenceGenerator< RNG >:
+ Collaboration diagram for RandomSequenceGenerator< RNG >:

Public Types

typedef Sample< std::vector< Real > > sample_type
 

Public Member Functions

 RandomSequenceGenerator (Size dimensionality, const RNG &rng)
 
 RandomSequenceGenerator (Size dimensionality, BigNatural seed=0)
 
const sample_typenextSequence () const
 
std::vector< BigNaturalnextInt32Sequence () const
 
const sample_typelastSequence () const
 
Size dimension () const
 

Private Attributes

Size dimensionality_
 
RNG rng_
 
sample_type sequence_
 
std::vector< BigNaturalint32Sequence_
 

Detailed Description

template<class RNG>
class QuantLib::RandomSequenceGenerator< RNG >

Random sequence generator based on a pseudo-random number generator.

Random sequence generator based on a pseudo-random number generator RNG.

Class RNG must implement the following interface:

RNG::sample_type RNG::next() const;

If a client of this class wants to use the nextInt32Sequence method, class RNG must also implement

unsigned long RNG::nextInt32() const;
Warning:
do not use with low-discrepancy sequence generator.
Examples
BasketLosses.cpp.

Definition at line 50 of file randomsequencegenerator.hpp.

Member Typedef Documentation

◆ sample_type

typedef Sample<std::vector<Real> > sample_type

Definition at line 52 of file randomsequencegenerator.hpp.

Constructor & Destructor Documentation

◆ RandomSequenceGenerator() [1/2]

RandomSequenceGenerator ( Size  dimensionality,
const RNG &  rng 
)

Definition at line 53 of file randomsequencegenerator.hpp.

◆ RandomSequenceGenerator() [2/2]

RandomSequenceGenerator ( Size  dimensionality,
BigNatural  seed = 0 
)
explicit

Definition at line 62 of file randomsequencegenerator.hpp.

Member Function Documentation

◆ nextSequence()

const sample_type & nextSequence ( ) const

Definition at line 68 of file randomsequencegenerator.hpp.

+ Here is the caller graph for this function:

◆ nextInt32Sequence()

std::vector< BigNatural > nextInt32Sequence ( ) const

Definition at line 77 of file randomsequencegenerator.hpp.

+ Here is the caller graph for this function:

◆ lastSequence()

const sample_type & lastSequence ( ) const

Definition at line 83 of file randomsequencegenerator.hpp.

+ Here is the caller graph for this function:

◆ dimension()

Size dimension ( ) const

Definition at line 86 of file randomsequencegenerator.hpp.

Member Data Documentation

◆ dimensionality_

Size dimensionality_
private

Definition at line 88 of file randomsequencegenerator.hpp.

◆ rng_

RNG rng_
private

Definition at line 89 of file randomsequencegenerator.hpp.

◆ sequence_

sample_type sequence_
mutableprivate

Definition at line 90 of file randomsequencegenerator.hpp.

◆ int32Sequence_

std::vector<BigNatural> int32Sequence_
mutableprivate

Definition at line 91 of file randomsequencegenerator.hpp.