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
+8-8Lines changed: 8 additions & 8 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(6)
154
+
Die(7)
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(15)
162
-
Die(19)
163
-
Die(4)
161
+
Die(13)
162
+
Die(8)
163
+
Die(20)
164
164
165
165
julia> a = Vector{Die}(undef, 3); rand!(a)
166
166
3-element Vector{Die}:
167
-
Die(17)
168
-
Die(20)
169
-
Die(15)
167
+
Die(4)
168
+
Die(14)
169
+
Die(10)
170
170
```
171
171
172
172
#### A simple sampler without pre-computed data
@@ -184,8 +184,8 @@ julia> rand(Die(4))
184
184
julia> rand(Die(4), 3)
185
185
3-element Vector{Any}:
186
186
3
187
+
2
187
188
4
188
-
1
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