dotnet / dotnet/dotnet-api-docs

System.Random thread safety topic is missing note about System.Random.Shared added in .NET6

Open
#8,851 1 comment 0 reactions 0 assignees View on GitHub
area-System.Runtime Pri3
Dominant language
C#
Stars
949
Forks
1.7k
Avg merge
3d 27m
Merged PRs (30d)
49

Description

https://learn.microsoft.com/en-us/dotnet/api/system.random?view=net-7.0#the-systemrandom-class-and-thread-safety says `System.Random` class is not thread safety and demonstrates how to make it thread safe using a lock object. But .NET 6 has added a thread safety [Random.Shared](https://learn.microsoft.com/en-us/dotnet/api/system.random.shared?view=net-6.0) which can be used. The topic doesn't mention it.

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.