|
|||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||
java.lang.Objectgames.strategy.engine.random.CryptoRandomSource
public class CryptoRandomSource
A random source that generates numbers using a secure algorithm shared between two players. Code originally contributed by Ben Giddings.
| Constructor Summary | |
|---|---|
CryptoRandomSource(PlayerID remotePlayer,
IGame game)
|
|
| Method Summary | |
|---|---|
static int[] |
bytesToInts(byte[] bytes)
|
int[] |
getRandom(int max,
int count,
java.lang.String annotation)
Delegates should not use random data that comes from any other source. |
int |
getRandom(int max,
java.lang.String annotation)
All delegates should use random data that comes from both players so that neither player cheats. |
static byte[] |
intsToBytes(int[] ints)
converts an int[] to a bytep[ |
static int[] |
xor(int[] val1,
int[] val2,
int max)
|
| Methods inherited from class java.lang.Object |
|---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Constructor Detail |
|---|
public CryptoRandomSource(PlayerID remotePlayer,
IGame game)
| Method Detail |
|---|
public static byte[] intsToBytes(int[] ints)
public static int[] bytesToInts(byte[] bytes)
public static int[] xor(int[] val1,
int[] val2,
int max)
public int getRandom(int max,
java.lang.String annotation)
getRandom in interface IRandomSource
public int[] getRandom(int max,
int count,
java.lang.String annotation)
getRandom in interface IRandomSource
|
|||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||