TraceMaker
C++ API of the engine
Loading...
Searching...
No Matches
tmk::RngStream Class Reference

A random stream identified by (seed, stage, item). More...

#include <core/rng.hpp>

Public Member Functions

TM_HD constexpr RngStream (std::uint64_t seed, std::uint32_t stage, std::uint64_t item)
TM_HD constexpr U32x4 block (std::uint64_t n) const
 Four 32-bit values for block n of this stream.
TM_HD constexpr std::uint64_t u64 (std::uint64_t n) const
 Draw n as a 64-bit value.
TM_HD constexpr double uniform (std::uint64_t n) const
 Draw n as a double in [0, 1) with 53 random bits.

Detailed Description

A random stream identified by (seed, stage, item).

Draw number n is a pure function of the stream and n, so any thread or GPU lane can jump to any draw without coordination.

Definition at line 62 of file rng.hpp.

Constructor & Destructor Documentation

◆ RngStream()

TM_HD constexpr tmk::RngStream::RngStream ( std::uint64_t seed,
std::uint32_t stage,
std::uint64_t item )
inlineconstexpr

Definition at line 64 of file rng.hpp.

Member Function Documentation

◆ block()

TM_HD constexpr U32x4 tmk::RngStream::block ( std::uint64_t n) const
inlineconstexpr

Four 32-bit values for block n of this stream.

Definition at line 70 of file rng.hpp.

◆ u64()

TM_HD constexpr std::uint64_t tmk::RngStream::u64 ( std::uint64_t n) const
inlineconstexpr

Draw n as a 64-bit value.

Definition at line 77 of file rng.hpp.

◆ uniform()

TM_HD constexpr double tmk::RngStream::uniform ( std::uint64_t n) const
inlineconstexpr

Draw n as a double in [0, 1) with 53 random bits.

Definition at line 83 of file rng.hpp.


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