Skip to content

Commit cbf6c1c

Browse files
authored
doc: add Xoshiro example (#43697)
1 parent a05cb7e commit cbf6c1c

File tree

1 file changed

+22
-0
lines changed

1 file changed

+22
-0
lines changed

stdlib/Random/src/Xoshiro.jl

Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,28 @@ from the parent, and uses SIMD to generate in parallel (i.e. the bulk stream con
2020
multiple interleaved xoshiro instances).
2121
The virtual PRNGs are discarded once the bulk request has been serviced (and should cause
2222
no heap allocations).
23+
24+
# Examples
25+
```jldoctest
26+
julia> using Random
27+
28+
julia> rng = Xoshiro(1234);
29+
30+
julia> x1 = rand(rng, 2)
31+
2-element Vector{Float64}:
32+
0.32597672886359486
33+
0.5490511363155669
34+
35+
julia> rng = Xoshiro(1234);
36+
37+
julia> x2 = rand(rng, 2)
38+
2-element Vector{Float64}:
39+
0.32597672886359486
40+
0.5490511363155669
41+
42+
julia> x1 == x2
43+
true
44+
```
2345
"""
2446
mutable struct Xoshiro <: AbstractRNG
2547
s0::UInt64

0 commit comments

Comments
 (0)