回答編集履歴
3
d
test
CHANGED
@@ -32,7 +32,7 @@
|
|
32
32
|
|
33
33
|
|
34
34
|
|
35
|
-
np.random.seed(
|
35
|
+
np.random.seed(1)
|
36
36
|
|
37
37
|
for i in range(4):
|
38
38
|
|
@@ -42,7 +42,7 @@
|
|
42
42
|
|
43
43
|
|
44
44
|
|
45
|
-
np.random.seed(
|
45
|
+
np.random.seed(1)
|
46
46
|
|
47
47
|
print(*np.random.rand(4), sep="\n")
|
48
48
|
|
@@ -52,7 +52,7 @@
|
|
52
52
|
|
53
53
|
|
54
54
|
|
55
|
-
np.random.seed(
|
55
|
+
np.random.seed(1)
|
56
56
|
|
57
57
|
for i in range(2):
|
58
58
|
|
@@ -66,32 +66,32 @@
|
|
66
66
|
|
67
67
|
```
|
68
68
|
|
69
|
-
0.
|
69
|
+
0.417022004702574
|
70
70
|
|
71
|
-
0.7
|
71
|
+
0.7203244934421581
|
72
72
|
|
73
|
-
0.
|
73
|
+
0.00011437481734488664
|
74
74
|
|
75
|
-
0.5
|
75
|
+
0.30233257263183977
|
76
76
|
|
77
77
|
----
|
78
78
|
|
79
|
-
0.
|
79
|
+
0.417022004702574
|
80
80
|
|
81
|
-
0.7
|
81
|
+
0.7203244934421581
|
82
82
|
|
83
|
-
0.
|
83
|
+
0.00011437481734488664
|
84
84
|
|
85
|
-
0.5
|
85
|
+
0.30233257263183977
|
86
86
|
|
87
87
|
----
|
88
88
|
|
89
|
-
0.
|
89
|
+
0.417022004702574
|
90
90
|
|
91
|
-
0.7
|
91
|
+
0.7203244934421581
|
92
92
|
|
93
|
-
0.
|
93
|
+
0.00011437481734488664
|
94
94
|
|
95
|
-
0.5
|
95
|
+
0.30233257263183977
|
96
96
|
|
97
97
|
```
|
2
d
test
CHANGED
@@ -15,3 +15,83 @@
|
|
15
15
|
|
16
16
|
|
17
17
|
[numpy/_mt19937.pyx at 77410e26dd94bdd07df096be06ee9aa7d5738ce6 · numpy/numpy](https://github.com/numpy/numpy/blob/77410e26dd94bdd07df096be06ee9aa7d5738ce6/numpy/random/_mt19937.pyx#L25)
|
18
|
+
|
19
|
+
|
20
|
+
|
21
|
+
## 追記
|
22
|
+
|
23
|
+
|
24
|
+
|
25
|
+
疑似乱数列の長さが N だとしたら、乱数を生成するたびに、疑似乱数列の先頭から乱数を取り出していくというイメージです。
|
26
|
+
|
27
|
+
|
28
|
+
|
29
|
+
```python
|
30
|
+
|
31
|
+
import numpy as np
|
32
|
+
|
33
|
+
|
34
|
+
|
35
|
+
np.random.seed(0)
|
36
|
+
|
37
|
+
for i in range(4):
|
38
|
+
|
39
|
+
print(np.random.rand())
|
40
|
+
|
41
|
+
print("----")
|
42
|
+
|
43
|
+
|
44
|
+
|
45
|
+
np.random.seed(0)
|
46
|
+
|
47
|
+
print(*np.random.rand(4), sep="\n")
|
48
|
+
|
49
|
+
print("----")
|
50
|
+
|
51
|
+
|
52
|
+
|
53
|
+
|
54
|
+
|
55
|
+
np.random.seed(0)
|
56
|
+
|
57
|
+
for i in range(2):
|
58
|
+
|
59
|
+
print(*np.random.rand(2), sep="\n")
|
60
|
+
|
61
|
+
```
|
62
|
+
|
63
|
+
|
64
|
+
|
65
|
+
|
66
|
+
|
67
|
+
```
|
68
|
+
|
69
|
+
0.5488135039273248
|
70
|
+
|
71
|
+
0.7151893663724195
|
72
|
+
|
73
|
+
0.6027633760716439
|
74
|
+
|
75
|
+
0.5448831829968969
|
76
|
+
|
77
|
+
----
|
78
|
+
|
79
|
+
0.5488135039273248
|
80
|
+
|
81
|
+
0.7151893663724195
|
82
|
+
|
83
|
+
0.6027633760716439
|
84
|
+
|
85
|
+
0.5448831829968969
|
86
|
+
|
87
|
+
----
|
88
|
+
|
89
|
+
0.5488135039273248
|
90
|
+
|
91
|
+
0.7151893663724195
|
92
|
+
|
93
|
+
0.6027633760716439
|
94
|
+
|
95
|
+
0.5448831829968969
|
96
|
+
|
97
|
+
```
|
1
修正
test
CHANGED
@@ -7,3 +7,11 @@
|
|
7
7
|
|
8
8
|
|
9
9
|
と書いてあるので、uint32 の範囲 (0~4294967295) の値であれば、指定できると思います。
|
10
|
+
|
11
|
+
|
12
|
+
|
13
|
+
ソースを見るとたしかに uint32_t 型で受け取るようになっていますね。
|
14
|
+
|
15
|
+
|
16
|
+
|
17
|
+
[numpy/_mt19937.pyx at 77410e26dd94bdd07df096be06ee9aa7d5738ce6 · numpy/numpy](https://github.com/numpy/numpy/blob/77410e26dd94bdd07df096be06ee9aa7d5738ce6/numpy/random/_mt19937.pyx#L25)
|