Correction du random

master
Céleste BARBOSA 12 months ago
parent 1f93741bea
commit af1a1c620e

@ -1,4 +1,5 @@
using CoreLibrary.Exceptions; using CoreLibrary.Exceptions;
using System.Security.Cryptography;
namespace CoreLibrary namespace CoreLibrary
{ {
@ -7,8 +8,6 @@ namespace CoreLibrary
/// </summary> /// </summary>
public class Plateau public class Plateau
{ {
private static Random random = new Random();
private readonly Code codeSecret; private readonly Code codeSecret;
private readonly Code?[] grille; private readonly Code?[] grille;
private readonly IEnumerable<Indicateur>[] indicateurs; private readonly IEnumerable<Indicateur>[] indicateurs;
@ -62,7 +61,7 @@ namespace CoreLibrary
for (int i = 0; i < tailleCode; ++i) for (int i = 0; i < tailleCode; ++i)
{ {
codeSecret.AjouterJeton(new Jeton(couleurs[random.Next(couleurs.Length)])); codeSecret.AjouterJeton(new Jeton(couleurs[RandomNumberGenerator.GetInt32(0, couleurs.Length)]));
} }
} }

Loading…
Cancel
Save