Created
February 19, 2013 14:27
-
-
Save npiv/4986375 to your computer and use it in GitHub Desktop.
unicorns
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
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