diff options
author | Pacien TRAN-GIRARD | 2016-05-09 11:47:52 +0200 |
---|---|---|
committer | Pacien TRAN-GIRARD | 2016-05-09 11:47:52 +0200 |
commit | cd1909c6a4117a65feb0a2f6e62bfcd9a4aa837b (patch) | |
tree | 4b7e4a7745aa172f6b32a2c739c6500323523cb8 /src/ch | |
parent | 4b5ceec97b1d01616c025c6ddbcece4455225543 (diff) | |
download | xblast-cd1909c6a4117a65feb0a2f6e62bfcd9a4aa837b.tar.gz |
Fix random test by resetting static state
Diffstat (limited to 'src/ch')
-rw-r--r-- | src/ch/epfl/xblast/server/Block.java | 14 |
1 files changed, 13 insertions, 1 deletions
diff --git a/src/ch/epfl/xblast/server/Block.java b/src/ch/epfl/xblast/server/Block.java index 4f3d033..5cb662c 100644 --- a/src/ch/epfl/xblast/server/Block.java +++ b/src/ch/epfl/xblast/server/Block.java | |||
@@ -55,7 +55,19 @@ public enum Block { | |||
55 | /** | 55 | /** |
56 | * Pseudo-random source for randomized behaviours. | 56 | * Pseudo-random source for randomized behaviours. |
57 | */ | 57 | */ |
58 | private static final Random RANDOM_SOURCE = new Random(RANDOM_SEED); | 58 | private static Random RANDOM_SOURCE; |
59 | |||
60 | /** | ||
61 | * Resets the random source used for bonus block spawning. | ||
62 | * Useful for deterministic tests. | ||
63 | */ | ||
64 | public static void resetRandomGenerator() { | ||
65 | RANDOM_SOURCE = new Random(RANDOM_SEED); | ||
66 | } | ||
67 | |||
68 | static { | ||
69 | resetRandomGenerator(); | ||
70 | } | ||
59 | 71 | ||
60 | /** | 72 | /** |
61 | * Corresponding bonus, or null. | 73 | * Corresponding bonus, or null. |