Browse Source

fix bug where random wasn't random because in same scope or something

master
Bd Nugget 1 year ago
parent
commit
c95f110ff2
1 changed files with 2 additions and 1 deletions
  1. +2
    -1
      GingerSimulator9000/GingerSimulator.cs

+ 2
- 1
GingerSimulator9000/GingerSimulator.cs View File

@@ -6,17 +6,18 @@ namespace GingerSimulator9000
{
private static char[] nigerChars = "niger".ToCharArray();
private static string ginger = "ginger";
private static Random rand = new Random();

private static string GetRandomNiger()
{
// Method should generate random 6 character string from nigerChars
string randomWord = "";
Random rand = new Random();
for (int i = 0; i < 6; i++)
{
int char_num = rand.Next(0, nigerChars.Length);
randomWord += nigerChars[char_num];
}
Console.WriteLine(randomWord);
return randomWord;
}


Loading…
Cancel
Save