-
Notifications
You must be signed in to change notification settings - Fork 4
Expand file tree
/
Copy pathtest-vector.cpp
More file actions
34 lines (30 loc) · 806 Bytes
/
Copy pathtest-vector.cpp
File metadata and controls
34 lines (30 loc) · 806 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
#include "xoshiro256ss.h"
#include <algorithm>
#include <cassert>
#include <iostream>
#include <random>
constexpr bool test() {
xoshiro256ss x(100);
assert(x() == 792317387143481937uLL);
assert(x() == 1418856489092323125uLL);
assert(x() == 6662743737787356053uLL);
assert(x() == 9823178768685107703uLL);
return true;
}
static_assert(test(), "compile-time OK");
void shuffle_example() {
int cards[52] {};
xoshiro256ss g;
std::shuffle(cards, cards + 52, g);
(void) std::uniform_int_distribution<int>(1,6)(g);
(void) std::uniform_real_distribution<float>(1,6)(g);
}
int main() {
xoshiro256ss x(100);
std::cout << x() << '\n';
std::cout << x() << '\n';
std::cout << x() << '\n';
std::cout << x() << '\n';
test();
shuffle_example();
}