samedi 29 juillet 2017

Random Sequence Generator in C#

I want to build a sequence randomiser mobile app in c#. I would like to retrieve the smallest and the largest number in an interval from two diffrent text boxes, and after I click the Generate button to display the random sequence of all the numbers in a new text box.

My code only displays one number. What's wrong with it?

Thanks.

 public sealed partial class MainPage : Page
{
    public MainPage()
    {
       this.InitializeComponent();           
    }
   private void button_Click(object sender, RoutedEventArgs e)
    {
        int seed = 345;
        var result = "";
        int min = Convert.ToInt32(textBox.Text);
        int max = Convert.ToInt32(textBox2.Text);
       Random r3 = new Random(seed);
        for (int i = min; i < max; i++)
        {
            ecran.Text = (/*"," + r3.Next(min, max)*/i).ToString();
        }
    }




Aucun commentaire:

Enregistrer un commentaire