I would like some help. I'm still kind of new to coding, but it seems like the numbers for my Random Number Generator isn't displaying the numbers.
The way I would like the numbers to be displayed is one after the other? Like you press a button and it shows a new number in its place.
Here's my code:
using System.Collections.Generic;
using System.LINQ;
using System.Text;
using System.Threading.Tasks;
Namespace ConBingo
{
class Program
{
static Random RanGen = new Random();
static void Main(string[] args)
{
int[] Nums = new int[90];
while (true)
{
Randomise(Nums);
}
}
static void Randomise(int[] Nums)
{
int RanNum, Temp;
//Set first entry to 1, second to two etc.
for (int counter = 0; counter<Nums.Length; counter++)
Nums[counter] = counter + 1;
// now swap each number with another chosen at random
for(int Pass = 0; Pass<Nums.Length;Pass++)
{
// choose a random number
RanNum = RanGen.Next(Nums.Length);
// first pass swap first number with one chosen at random, second pass sway second number
Temp = Nums[Pass];
Nums[Pass] = Nums[RanNum];
Nums[RanNum] = Temp;
}
}
}
}
Aucun commentaire:
Enregistrer un commentaire