Photon Engine 2.0.0-beta
A physically based renderer.
Loading...
Searching...
No Matches
Random.h
Go to the documentation of this file.
1#pragma once
2
3#include <Common/primitive_type.h>
4
5#include <cstddef>
6#include <array>
7
8namespace ph::math
9{
10
13class Random final
14{
15public:
19 static real sample();
20
23 template<std::size_t N, typename T = real>
24 static std::array<T, N> sampleND();
25
29 static std::size_t index(std::size_t lowerBound, std::size_t upperBound);
30
34 static uint32 bits32();
35
39 static uint64 bits64();
40};
41
42}// end namespace ph::math
43
Get random values from default RNG.
Definition Random.h:14
static std::array< T, N > sampleND()
Similar to sample(), except the sample is N-dimensional.
Definition Random.ipp:11
static std::size_t index(std::size_t lowerBound, std::size_t upperBound)
Get a uniform random integer value in [lowerBound, upperBound).
Definition Random.ipp:23
static real sample()
Get a uniform random value in [0, 1].
Definition Random.cpp:44
static uint32 bits32()
Definition Random.cpp:49
static uint64 bits64()
Definition Random.cpp:54
Math functions and utilities.
Definition TransformInfo.h:10