From f64256b9835b8005ca15cf944bc2aac1326aeb0f Mon Sep 17 00:00:00 2001 From: Andrew Hillier Date: Fri, 8 Dec 2023 18:52:09 +0000 Subject: [PATCH] use shared instance of random --- content/en/docs/instrumentation/net/getting-started.md | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/content/en/docs/instrumentation/net/getting-started.md b/content/en/docs/instrumentation/net/getting-started.md index 780aa6a11d96..37eadeabc2ca 100644 --- a/content/en/docs/instrumentation/net/getting-started.md +++ b/content/en/docs/instrumentation/net/getting-started.md @@ -69,8 +69,7 @@ string HandleRollDice([FromServices]ILogger logger, string? player) int RollDice() { - var rng = new Random(); - return rng.Next(1, 6); + return Random.Shared.Next(1, 7); } app.MapGet("/rolldice/{player?}", HandleRollDice);