src.it.unimi.dsi.test.WTF Maven / Gradle / Ivy
Go to download
Show more of this group Show more artifacts with this name
Show all versions of dsiutils Show documentation
Show all versions of dsiutils Show documentation
The DSI utilities are a mishmash of classes accumulated during the last twenty years in projects developed at the DSI (Dipartimento di Scienze dell'Informazione, i.e., Information Sciences Department), now DI (Dipartimento di Informatica, i.e., Informatics Department), of the Universita` degli Studi di Milano.
package it.unimi.dsi.test;
import java.util.Random;
public class WTF {
/* From https://twitter.com/joshbloch/status/269478731238760448
*
* Note that ThreadLocalRandom uses the same algorithm as Random.
*/
public static void main(String[] arg) {
final int shift = arg.length == 0 ? 0 : Integer.parseInt(arg[0]);
for (int i = 0; i < 1000; i++)
System.out.println(new Random(i).nextInt(1 << shift));
}
}