File: random.cc

package info (click to toggle)
sqlsmith 1.4-1
  • links: PTS, VCS
  • area: main
  • in suites: bookworm, sid, trixie
  • size: 540 kB
  • sloc: cpp: 3,221; sql: 175; makefile: 33; sh: 1
file content (35 lines) | stat: -rw-r--r-- 639 bytes parent folder | download | duplicates (3)
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
35
#include "random.hh"

namespace smith {
  std::mt19937_64 rng;
}

int d6() {
  static std::uniform_int_distribution<> pick(1, 6);
  return pick(smith::rng);
}

int d9() {
  static std::uniform_int_distribution<> pick(1, 9);
  return pick(smith::rng);
}

int d12() {
  static std::uniform_int_distribution<> pick(1, 12);
  return pick(smith::rng);
}

int d20() {
  static std::uniform_int_distribution<> pick(1, 20);
  return pick(smith::rng);
}

int d42() {
  static std::uniform_int_distribution<> pick(1, 42);
  return pick(smith::rng);
}

int d100() {
  static std::uniform_int_distribution<> pick(1, 100);
  return pick(smith::rng);
}