Vulkan Schnee 0.0.1
High-performance rendering engine
Loading...
Searching...
No Matches
Random.h
Go to the documentation of this file.
1#pragma once
2
3#include <random>
4
5namespace Math
6{
7 inline std::mt19937& randomEngine()
8 {
9 static thread_local std::mt19937 engine( std::random_device{}() );
10 return engine;
11 }
12
13 inline int randomInt( int min, int max )
14 {
15 std::uniform_int_distribution<int> distribution( min, max );
16 return distribution( randomEngine() );
17 }
18
19 inline float randomFloat( float min, float max )
20 {
21 std::uniform_real_distribution<float> distribution( min, max );
22 return distribution( randomEngine() );
23 }
24}
Definition Random.h:6
int randomInt(int min, int max)
Definition Random.h:13
float randomFloat(float min, float max)
Definition Random.h:19
std::mt19937 & randomEngine()
Definition Random.h:7