Chebyshev
Unit testing for scientific software
Loading...
Searching...
No Matches
generator.h
Go to the documentation of this file.
1
5
6#ifndef CHEYBYSHEV_GENERATOR_H
7#define CHEYBYSHEV_GENERATOR_H
8
9#include <functional>
10#include "../core/common.h"
11#include "../core/random.h"
12
13
14namespace chebyshev {
15namespace benchmark {
16
18 namespace generator {
19
20
26 inline auto uniform1D(long double a, long double b) {
27
28 return [a, b](random::random_source& rnd) {
29 return rnd.uniform(a, b);
30 };
31 }
32
33
39 inline auto discrete1D(long int a, long int b) {
40
41 long long int length = a < b ? (b - a) : (a - b);
42
43 return [a, length](random::random_source& rnd) {
44 return a + (rnd.natural() % uint64_t(length));
45 };
46 }
47
48 }
49
50}}
51
52#endif
auto uniform1D(long double a, long double b)
Uniform generator over a domain.
Definition generator.h:26
auto discrete1D(long int a, long int b)
Discrete uniform generator over a domain.
Definition generator.h:39
General namespace of the framework.
Definition benchmark.h:22
constexpr FloatType get_nan()
Get a quiet NaN of the specified floating point type.
Definition common.h:65
A source of pseudorandom numbers.
Definition random.h:39