mirror of
https://github.com/aicodix/code.git
synced 2026-04-27 14:30:36 +00:00
made random seeding optional
This commit is contained in:
parent
d319189d7a
commit
2d5e782135
1 changed files with 6 additions and 2 deletions
|
|
@ -14,10 +14,14 @@ Copyright 2024 Ahmet Inan <inan@aicodix.de>
|
|||
int main()
|
||||
{
|
||||
const int MAX_N = 128;
|
||||
std::random_device rd;
|
||||
unsigned seed = 42;
|
||||
if (1) {
|
||||
std::random_device rd;
|
||||
seed = rd();
|
||||
}
|
||||
typedef std::default_random_engine generator;
|
||||
typedef std::uniform_int_distribution<int> distribution;
|
||||
auto rand = std::bind(distribution(1, MAX_N), generator(rd()));
|
||||
auto rand = std::bind(distribution(1, MAX_N), generator(seed));
|
||||
int a[MAX_N], b[MAX_N], c[MAX_N], d[MAX_N], e[MAX_N], f[MAX_N], g[MAX_N];
|
||||
CODE::MergeSort<int, MAX_N> merge_sort;
|
||||
for (int loop = 0; loop < 1000000; ++loop) {
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue