summary refs log tree commit diff stats
path: root/Source/Random.h
blob: e4700f3f1adadbb1718a7112b2ae8ec1a88ee8ab (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
#pragma once

static int s_seed;

class Random
{
public:
	static void SetSeed(int seed) {
		s_seed = seed;
	}

	static int RandInt(int min, int max) {
		s_seed = (214013 * s_seed + 2531011) % 2147483648;
		if (min == max) return min;
		return (s_seed % (max - (min - 1))) + min;
	}
};