File: PseudoRandom.h

package info (click to toggle)
zxing-cpp 3.0.2%2Bds-2
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid
  • size: 30,204 kB
  • sloc: ansic: 69,384; cpp: 34,624; php: 2,790; python: 199; makefile: 31; sh: 3
file content (18 lines) | stat: -rw-r--r-- 348 bytes parent folder | download | duplicates (5)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
#pragma once
#include <random>

namespace ZXing {

class PseudoRandom {
	std::minstd_rand _random;

public:
	PseudoRandom(size_t seed) : _random(static_cast<std::minstd_rand::result_type>(seed)) {}

	template <typename IntType>
	IntType next(IntType low, IntType high) {
		return std::uniform_int_distribution<IntType>(low, high)(_random);
	}
};

}