Develop Biology
The language of life
bio::random Namespace Reference

Functions

float NormalFloat (float mean, float standardDeviation)
 
float UniformFloat (float min, float max)
 

Function Documentation

◆ NormalFloat()

float bio::random::NormalFloat ( float  mean,
float  standardDeviation 
)

x ~ Normal as float

Parameters
mean
standardDeviation
Returns
a number normally distributed around mean with standardDeviation.

Definition at line 35 of file Random.cpp.

39{
40 #if BIO_CPP_VERSION >= 11
41 std::normal_distribution<float> dist
42 {
43 mean,
44 standardDeviation
45 };
46 return dist(gen);
47 #else
48 return 0;
49 #endif
50}

◆ UniformFloat()

float bio::random::UniformFloat ( float  min,
float  max 
)

x ~ Uniform

Parameters
min
max
Returns
a value between min and max, uniformly distributed.

Definition at line 52 of file Random.cpp.

56{
57 #if BIO_CPP_VERSION >= 11
58 std::uniform_real_distribution<float> dist(
59 min,
60 max
61 );
62 return dist(gen);
63 #else
64 return 0;
65 #endif
66}