-
-
Notifications
You must be signed in to change notification settings - Fork 29
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Replace mersenne twister (closes #896)
1 parent
2e6deec
commit 91e8672
Showing
5 changed files
with
139 additions
and
158 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,17 @@ | ||
package legend.core; | ||
|
||
public class Random extends java.util.Random { | ||
/** | ||
* Returns the 32 high bits of Stafford variant 4 mix64 function as int. | ||
* http://zimbry.blogspot.com/2011/09/better-bit-mixing-improving-on.html | ||
*/ | ||
private static int mix32(long z) { | ||
z = (z ^ (z >>> 33)) * 0x62a9d9ed799705f5L; | ||
return (int)(((z ^ (z >>> 28)) * 0xcb24d0a5c88c35b3L) >>> 32); | ||
} | ||
|
||
@Override | ||
public int nextInt() { | ||
return mix32(super.nextInt()); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Large diffs are not rendered by default.
Oops, something went wrong.
14 changes: 0 additions & 14 deletions
14
src/main/java/legend/game/combat/types/MersenneTwisterSeed.java
This file was deleted.
Oops, something went wrong.