When the Generate button is pressed an array of doubles with a random length of 50 to 1000 values will be created. The array will be filled with random double values ( use rndGen.NextDouble( ) ) each with a range of 0.0 to 100.0. The contents of the array will be displayed in the textbox (shown in attached thumbnails) using two decimal places of accuracy.
my question is how to make random double values?
my code only giving me int.
Also i tried this
int iNum = rNumber.Next(0, 100);
double dNum = rNumber.NextDouble();
double dTotal = iNum + dNum;
but i don't know how to put in array
public partial class Form1 : Form
{
Random rNumber = new Random();
public Form1()
{
InitializeComponent();
}
private void BTN_generate_Click(object sender, EventArgs e)
{
int ilength = rNumber.Next(50, 1000);
int[] iArray = new int[ilength];
for (int i = 0; i < iArray.Length; i++)
{
iArray[i] = rNumber.Next(101);
}
Console.WriteLine();
foreach (int iValue in iArray)
{
textBox1.Text += iValue.ToString() + ", ";
}
}