Exemple #1
0
 private void btnRandomize_Click(object sender, RoutedEventArgs e)
 {
     if (string.IsNullOrEmpty(txtBoxSequence.Text))
     {
         return;
     }
     string[] data = txtBoxSequence.Text.Split(new string[] { "," }, StringSplitOptions.RemoveEmptyEntries);
     CongruentalRandomNumberGenerator.RandomizeInput <string>(data);
     AssignSequenceToTextBox(data);
 }
Exemple #2
0
        private void btnCreate_Click(object sender, RoutedEventArgs e)
        {
            if (rdButtonParameters.IsChecked.HasValue && rdButtonParameters.IsChecked.Value)
            {
                ushort A;
                uint   seed, M, B;

                if (!ushort.TryParse(txtBoxA.Text, out A))
                {
                    MessageBox.Show("Value for A is incorrect.Use valid ushort value.");
                    return;
                }
                if (!uint.TryParse(txtBoxB.Text, out B))
                {
                    MessageBox.Show("Value for B is incorrect.Use valid uint value.");
                    return;
                }
                if (!uint.TryParse(txtBoxSeed.Text, out seed))
                {
                    MessageBox.Show("Value for seed is incorrect.Use valid uint value.");
                    return;
                }
                if (!uint.TryParse(txtBoxM.Text, out M))
                {
                    MessageBox.Show("Value for M is incorrect.Use valid uint value.");
                    return;
                }
                this.rndGen = new CongruentalRandomNumberGenerator(A, B, seed, M);
            }
            else
            {
                this.rndGen = new CongruentalRandomNumberGenerator();
            }
            GeneratedCount        = 0;
            btnGenerate.IsEnabled = true;
            btnReset.IsEnabled    = true;
        }