Project

General

Profile

Actions

Feature #17322

closed

Deprecate `Random::DEFAULT` and introduce `Random.default()` method to provide Ractor-supported default random generator

Added by ko1 (Koichi Sasada) over 3 years ago. Updated over 3 years ago.

Status:
Closed
Assignee:
-
Target version:
-
[ruby-core:100807]

Description

Random::DEFAULT a default random generator used by rand, srand, Array#shuffle without a given random generator, and so on.

Random generators are not thread-safe, so they are not ractor safe, and they are not shareable.
So a program refer to Random::DEFAULT on non-main ractor, it causes an error.

To provide per-ractor default random generator, this ticket propose the Random.default() method which returns per-ractor random generator.
Random::DEFAULT is a result of Random.default() on main-ractor and it should be deprecated, or at least it should not be used on multi-ractor supporting apps and libraries.


Related issues 1 (0 open1 closed)

Related to Ruby master - Feature #17351: Deprecate Random::DEFAULTClosedmatz (Yukihiro Matsumoto)Actions
Actions

Also available in: Atom PDF

Like0
Like0Like0Like0Like0Like0Like0Like0Like0Like0Like0Like0Like0Like0Like0Like0