Created
November 11, 2013 17:12
-
-
Save pjc0247/7416728 to your computer and use it in GitHub Desktop.
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
| import java.lang.reflect.*; | |
| import java.util.Random; | |
| class Test{ | |
| static { | |
| try { | |
| Field field = Math.class.getDeclaredField("randomNumberGenerator"); | |
| field.setAccessible(true); | |
| field.set(null, new Random(){ | |
| @Override | |
| public double nextDouble(){ | |
| return 1; | |
| } | |
| }); | |
| } | |
| catch (Exception e) { | |
| throw new RuntimeException(e); | |
| } | |
| } | |
| public static void main(String[] args){ | |
| System.out.println( java.lang.Math.random() ); | |
| } | |
| } |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment