home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
GameStar Special 2004 August
/
GSSH0804.iso
/
Action
/
Parsec47
/
Parsec47.exe
/
p47
/
src
/
abagames
/
util
/
Rand.d
< prev
next >
Wrap
Text File
|
2003-11-29
|
725b
|
41 lines
/*
* $Id: Rand.d,v 1.1.1.1 2003/11/28 17:26:30 kenta Exp $
*
* Copyright 2003 Kenta Cho. All rights reserved.
*/
module abagames.util.Rand;
import std.date;
import mt;
/**
* Random number generator.
*/
public class Rand {
public this() {
d_time timer = getUTCtime();
init_genrand(timer);
}
public void setSeed(long n) {
init_genrand(n);
}
public int nextInt(int n) {
return genrand_int32() % n;
}
public int nextSignedInt(int n) {
return genrand_int32() % (n * 2) - n;
}
public float nextFloat(float n) {
return genrand_real1() * n;
}
public float nextSignedFloat(float n) {
return genrand_real1() * (n * 2) - n;
}
}