Skip to content

Commit 0ccb8b6

Browse files
danielweKristofferC
authored andcommitted
Update TaskLocalRNG docstring according to #49110 (#55863)
Since #49110, which is included in 1.10 and 1.11, spawning a task no longer advances the parent task's RNG state, so this statement in the docs was incorrect. (cherry picked from commit c601b11)
1 parent c3ea488 commit 0ccb8b6

File tree

1 file changed

+5
-2
lines changed

1 file changed

+5
-2
lines changed

stdlib/Random/src/Xoshiro.jl

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -107,8 +107,8 @@ end
107107
TaskLocalRNG
108108
109109
The `TaskLocalRNG` has state that is local to its task, not its thread.
110-
It is seeded upon task creation, from the state of its parent task.
111-
Therefore, task creation is an event that changes the parent's RNG state.
110+
It is seeded upon task creation, from the state of its parent task, but without
111+
advancing the state of the parent's RNG.
112112
113113
As an upside, the `TaskLocalRNG` is pretty fast, and permits reproducible
114114
multithreaded simulations (barring race conditions), independent of scheduler
@@ -119,6 +119,9 @@ endianness and possibly word size.
119119
120120
Using or seeding the RNG of any other task than the one returned by `current_task()`
121121
is undefined behavior: it will work most of the time, and may sometimes fail silently.
122+
123+
!!! compat "Julia 1.10"
124+
Task creation no longer advances the parent task's RNG state as of Julia 1.10.
122125
"""
123126
struct TaskLocalRNG <: AbstractRNG end
124127
TaskLocalRNG(::Nothing) = TaskLocalRNG()

0 commit comments

Comments
 (0)