Esempio n. 1
0
 /// <inheritdoc />
 public void Randomize()
 {
     IGenerateRandom rnd = new MersenneTwisterGenerateRandom();
     for (int i = 0; i < _data.Length; i++)
     {
         _data[i] = rnd.NextDouble()*2.0 - 1.0;
     }
     SortData();
 }
Esempio n. 2
0
        public void RandomizeParticles()
        {
            IGenerateRandom random = new MersenneTwisterGenerateRandom();

            for (int i = 0; i < ParticleCount; i++)
            {
                var p = new Particle(2);
                p.Location[0] = random.NextDouble(OutputCanvas.ActualWidth);
                p.Location[1] = random.NextDouble(OutputCanvas.ActualHeight);
                p.Velocity[0] = 3;
                p.Velocity[1] = random.NextDouble(2.0*Math.PI);
                _particles.Add(p);
            }
        }