dsplib 1.1.0
C++ DSP library for MATLAB-like coding
Loading...
Searching...
No Matches
random.h
1#include <dsplib/array.h>
2
3#include <array>
4
5namespace dsplib {
6
7//control random number generator
8//each thread has its own seed for generation
9void rng(int seed);
10
11//note: can be slow for every call
12//randi(n) faster than loop(n).randi()
13
14//integer uniform [1, imax]
15int randi(int imax);
16arr_int randi(int imax, int n);
17
18//integer uniform [imin, imax]
19arr_int randi(std::array<int, 2> range, int n);
20int randi(std::array<int, 2> range);
21
22//uniformly distributed random numbers
23real_t rand();
24arr_real rand(int n);
25arr_real rand(std::array<real_t, 2> range, int n);
26
27//normally distributed random numbers
28real_t randn();
29arr_real randn(int n);
30
31} // namespace dsplib