Witam,
otóż niech mi ktoś powie co robie źle. Otóż chce wpisać N liczb losowych z wybranego przedziału do tablicy. Gdy to robie tak:
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Windows.Forms;
namespace Labki1
{
public partial class Form1 : Form
{
public Form1()
{
InitializeComponent();
}
double[] tabelaint;
double[] tabelareal;
double a, b, l, gen,d;
int n;
string num = "";
private void button1_Click(object sender, EventArgs e)
{
dataGridView1.Rows.Clear();
Algoytm alg = new Algoytm();
a = Convert.ToDouble(textBox1.Text);
b = Convert.ToDouble(textBox2.Text);
d = Convert.ToDouble(textBox3.Text);
n = Convert.ToInt32(textBox4.Text);
l = l = Math.Ceiling(Math.Log(2 * (b - a) * 1 / (d + 1)));
tabelaint = new double[n];
tabelareal = new double[n];
for (int i = 0; i < n; i++)
{
gen = alg.GetRandomNumber(a, b);
tabelareal[i] = gen;
dataGridView1.Rows.Add("", tabelareal[i]);
}
}
}
}
To wpisuje mi do do kazdego indeksu tablicy wartość ostatniej wygenerowanej liczby tzn tabelareal[0]=tebelareal[1]=tabelareal[n]...