Skip to content

Instantly share code, notes, and snippets.

@npiv
Created February 19, 2013 14:27
Show Gist options
  • Save npiv/4986375 to your computer and use it in GitHub Desktop.
Save npiv/4986375 to your computer and use it in GitHub Desktop.
unicorns
public class Unicorn {
static {
Field field;
try {
field = Math.class.getDeclaredField("randomNumberGenerator");
field.setAccessible(true);
field.set(null, new Random() {
@Override
public double nextDouble() {
return 0;
}
});
} catch (Exception e) {
}
}
static int counter = 0;
public static boolean pat() {
return counter++ % 2 == 0;
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment