Marine systems simulation
Loading...
Searching...
No Matches
LcgRandom.h
1#pragma once
3
4#include <cstdint>
5
6namespace marenv::calc
7{
9
11
13{
14public:
20 void seed(uint32_t s);
21
22protected:
29
34 uint32_t rnd();
35 uint32_t _seed;
36 uint32_t a;
37 uint32_t c;
38 uint32_t m;
39};
41
43{
44public:
50 LcgRandomTrunc(uint32_t seed = 0);
55 uint32_t rnd();
56};
58
60{
61public:
67 LcgRandom(uint32_t seed = 0);
68
73 uint32_t rnd();
74
82 double rnd(double min, double max);
83};
84} // namespace marenv::calc
Base class for generating very simple pseudo-random numbers.
Definition LcgRandom.h:13
uint32_t m
Integer used in the generation of next random number.
Definition LcgRandom.h:38
uint32_t a
Integer used in the generation of next random number.
Definition LcgRandom.h:36
uint32_t _seed
The current seed (changed for each random number generation).
Definition LcgRandom.h:35
LcgRandomBase(uint32_t seed)
uint32_t c
Integer used in the generation of next random number.
Definition LcgRandom.h:37
Generation of very simple pseudo-random numbers.
Definition LcgRandom.h:43
LcgRandomTrunc(uint32_t seed=0)
Generation of very simple pseudo-random numbers.
Definition LcgRandom.h:60
LcgRandom(uint32_t seed=0)
double rnd(double min, double max)