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
36
37
38
39
40
41
public struct Well512
{
static uint[] state = new uint[16];
static uint index = 0;
static Well512()
{
for(int i=0;i<16;i++)
{
//์Šคํ…Œ์ดํŠธ ์•ˆ์— ๋“ค์–ด๊ฐ€๋Š” ๊ฐ’๋“ค์ด ์ผ์ข…์˜ ์‹œ๋“œ ์—ญํ• ์„ ํ•ด์คŒ. ์ด ๊ฐ’๋“ค์ด ๋™์ผํ•˜๋ฉด ํ•ญ์ƒ ๋™์ผํ•œ ๋žœ๋ค๊ฐ’์ด ๋‚˜์˜ด
state[i] = (uint)Random.Range(10,10000);
}
}
public static uint Next(int minValue, int maxValue)
{
return (uint)((Next() % (maxValue - minValue)) + minValue);
}
public static uint Next(uint maxValue)
{
return Next() % maxValue;
}
public static uint Next()
{
uint a, b, c, d;
a = state[index];
c = state[(index + 13) & 15];
b = a ^ c ^ (a << 16) ^ (c << 15);
c = state[(index + 9) & 15];
c ^= (c >> 11);
a = state[index] = b ^ c;
d = a ^ ((a << 5) & 0xda442d24U);
index = (index + 15) & 15;
a = state[index];
state[index] = a ^ b ^ d ^ (a << 2) ^ (b << 18) ^ (c << 28);
return state[index];
}
}
cs

๊ธฐ์กด rand๋ณด๋‹ค 5.6๋ฐฐ ๋น ๋ฅด๊ณ  ํ›จ์”ฌ ๋งŽ์ด ๊ณ ๋ฅด๊ฒŒ ๋ถ„ํฌ๋˜๋Š” ์•Œ๊ณ ๋ฆฌ์ฆ˜์ž„. ๊ถ๊ธˆํ•˜๋ฉด ๋ฉ”๋ฅด์„ผ ํŠธ์œ„์Šคํ„ฐ๋ž‘ well512 ๊ฒ€์ƒ‰ํ•ด๋ด