Created
November 27, 2012 16:37
-
-
Save johnmay/4155325 to your computer and use it in GitHub Desktop.
Number Rotation
This file contains hidden or 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
| public int rotate(int value, int n){ | |
| for(int i = 0; i < n; i++) | |
| value = nextInt(value); | |
| return value; | |
| } | |
| public int nextInt(int seed){ | |
| // return pseudo random number from the given seed | |
| } | |
| public int rotate(int value) { | |
| return rotate(value & 1 + 0x05); // 1-6 times | |
| } |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment