I have to create a program that generates as many random numbers as the user selects in a "numeric up and down" control object and displays the random numbers in a list box.
I know that I must use nested loops and a random number Generator and I was able to make a list of numbers appear in the listbox but not any random numbers.
I was able to get the numeric up and down involved in dictating the amount of numbers that show up in the list box.
the only problem I'm having is making the numbers random.
my code is:
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Windows.Forms;
namespace RandomNumberGenerator
{
public partial class frmRandomNumbers : Form
{
public frmRandomNumbers()
{
InitializeComponent();
}
private void btnGenerate_Click(object sender, EventArgs e)
{
//VAliables are declared
int FirstNumber;
int aRandomNumber;
//Numbers to show up in the list box
this.lstNumbers.Items.Clear();
for (aRandomNumber = 0; aRandomNumber <= numudNumberOfRandoms.Value; aRandomNumber++)
{
for (FirstNumber = 0; FirstNumber <= 0; FirstNumber++)
this.lstNumbers.Items.Add(FirstNumber + " -> " + aRandomNumber);
}
}
}
}
How do you make the numbers Random???

New Topic/Question
Reply




MultiQuote






|