File: PseudoRandom.h

package info (click to toggle)
zxing-cpp 2.3.0-4
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid, trixie
  • size: 26,832 kB
  • sloc: cpp: 32,803; ansic: 18,360; php: 1,156; python: 215; makefile: 25; sh: 3
file content (18 lines) | stat: -rw-r--r-- 348 bytes parent folder | download | duplicates (3)
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);
	}
};

}