Skip to content

Instantly share code, notes, and snippets.

@johnmay
Created November 27, 2012 16:37
Show Gist options
  • Select an option

  • Save johnmay/4155325 to your computer and use it in GitHub Desktop.

Select an option

Save johnmay/4155325 to your computer and use it in GitHub Desktop.
Number Rotation
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