Last active
July 16, 2018 10:00
-
-
Save umyuu/a1e9a1df480707eebaa0d91ac4df8689 to your computer and use it in GitHub Desktop.
Java 乱数生成いろいろ。
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
```Java | |
import java.util.Random; | |
import java.util.Arrays; | |
class Wandbox | |
{ | |
public static void main(String[] args) | |
{ | |
final Random rnd = new Random(); | |
final int size = 10; | |
rnd.setSeed(42); // テスト再現性を保証するため。 | |
// 1D | |
int[] samples = rnd.ints(0, 2).limit(size).toArray(); | |
System.out.println(Arrays.toString(samples)); | |
} | |
} | |
``` |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Uh oh!
There was an error while loading. Please reload this page.