You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: stdlib/Random/docs/src/index.md
+9-9Lines changed: 9 additions & 9 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -151,22 +151,22 @@ Scalar and array methods for `Die` now work as expected:
151
151
152
152
```jldoctest Die; setup = :(Random.seed!(1))
153
153
julia> rand(Die)
154
-
Die(7)
154
+
Die(5)
155
155
156
156
julia> rand(MersenneTwister(0), Die)
157
157
Die(11)
158
158
159
159
julia> rand(Die, 3)
160
160
3-element Vector{Die}:
161
-
Die(13)
162
-
Die(8)
163
-
Die(20)
161
+
Die(9)
162
+
Die(15)
163
+
Die(14)
164
164
165
165
julia> a = Vector{Die}(undef, 3); rand!(a)
166
166
3-element Vector{Die}:
167
-
Die(4)
168
-
Die(14)
169
-
Die(10)
167
+
Die(19)
168
+
Die(7)
169
+
Die(17)
170
170
```
171
171
172
172
#### A simple sampler without pre-computed data
@@ -183,9 +183,9 @@ julia> rand(Die(4))
183
183
184
184
julia> rand(Die(4), 3)
185
185
3-element Vector{Any}:
186
-
3
187
186
2
188
-
4
187
+
3
188
+
3
189
189
```
190
190
191
191
Given a collection type `S`, it's currently assumed that if `rand(::S)` is defined, an object of type `eltype(S)` will be produced. In the last example, a `Vector{Any}` is produced; the reason is that `eltype(Die) == Any`. The remedy is to define `Base.eltype(::Type{Die}) = Int`.
0 commit comments