Random.h
Go to the documentation of this file.
1 
2 #pragma once
3 
4 #include <ionConfig.h>
5 #include "ionTypes.h"
6 
7 #include <cstdlib>
8 
9 
10 namespace ion
11 {
12 
15  static inline float frand()
16  {
17  return std::rand() / (float) RAND_MAX;
18  }
19 
22  static inline float nrand()
23  {
24  return (std::rand() / (float) RAND_MAX) * 2.f - 1.f;
25  }
26 
29  class Random
30  {
31 
32  public:
33 
34  static float Between(float const Min, float const Max)
35  {
36  return frand() * (Max - Min) + Min;
37  }
38 
39  static int Between(int const Min, int const Max)
40  {
41  return std::rand() % (Max - Min) + Min;
42  }
43 
44  };
45 
46 }
static float Between(float const Min, float const Max)
Definition: Random.h:34
static int Between(int const Min, int const Max)
Definition: Random.h:39
Definition: CCatmullRomAdvancedSplineInterpolator.h:7
Defines typedefs for integer and floating point types.
Helper methods for generating random numbers.
Definition: Random.h:29