Friday 30 August 2013

Charting Randomness


Introduction & Description: Coming shorty..

For a deeper understanding on all that has been mentioned above, please check out the 5 video links where I go through the demo in full detail.




C# Experiments: Charting Randomness (Part 1)



C# Experiments: Charting Randomness (Part 2)



C# Experiments: Charting Randomness (Part 3)



C# Experiments: Charting Randomness (Part 4)



C# Experiments: Charting Randomness (Part 5)



The code typed-in during the tutorial-session is as follows:-

    var rand = new Random();
    var set = new HashSet<int>();

    //for (int i = 0; i < 10000; i++)
    //{
    //    //var rand = new Random();
    //    set.Add(rand.Next());
    //}

    var valueBucket = new List<int>();

    chart1.Titles.Clear();
    chart1.Series.Clear();

    chart1.Titles.Add("Randomness");
    chart1.Palette = System.Windows.Forms.DataVisualization.Charting.ChartColorPalette.EarthTones;

    //Uniform Distribution [random]
    //for (int i = 0; i < 10; i++)
    //    valueBucket.Add(0);

    //for (int i = 0; i < 100000; i++)
    //    valueBucket[rand.Next(0, 10)]++;

    ////chart1.Series.Add("Numbers");
    ////for (int i = 0; i < 10; i++)
    ////    chart1.Series[0].Points.Add(valueBucket[i]);

    //for (int i = 0; i < 10; i++)
    //    chart1.Series.Add(i.ToString()).Points.Add(valueBucket[i]);

    //Long-Tailed Distribution[random1 * random2]
    //for (int i = 0; i < 82; i++)
    //    valueBucket.Add(0);

    //for (int i = 0; i < 100000; i++)
    //    valueBucket[rand.Next(0, 10) * rand.Next(0, 10)]++;

    //for (int i = 0; i < 82; i++)
    //    chart1.Series.Add(i.ToString()).Points.Add(valueBucket[i]);


    //Gaussian Distribution [random1 + random2]
    //for (int i = 0; i < 19; i++)
    //    valueBucket.Add(0);

    //for (int i = 0; i < 100000; i++)
    //    valueBucket[rand.Next(0, 10) + rand.Next(0, 10)]++;

    //for (int i = 0; i < 19; i++)
    //    chart1.Series.Add(i.ToString()).Points.Add(valueBucket[i]);

    //Uniform Distribution [2 * random]
    //for (int i = 0; i < 19; i++)
    //    valueBucket.Add(0);

    //for (int i = 0; i < 100000; i++)
    //    valueBucket[2 * rand.Next(0, 10)]++;

    //for (int i = 0; i < 19; i++)
    //    chart1.Series.Add(i.ToString()).Points.Add(valueBucket[i]);

    //Tapered Edge
    for (int i = 0; i < 200; i++)
        valueBucket.Add(0);

    var mid = 100;

    for (int i = 0; i < 200; i++)
    {
        valueBucket[i] = mid;
        mid = rand.Next(mid - 2, mid + 3);
    }


    for (int i = 0; i < 200; i++)
    {
        chart1.Series.Add(i.ToString()).Points.Add(valueBucket[i]);
        chart1.Series[i.ToString()].ChartType = System.Windows.Forms.DataVisualization.Charting.SeriesChartType.Bar;
    }


Thank you for reading this post and watching the videos. Please Subscribe, Comment, and Rate the channel if you liked the videos.

Goto C# Experiments to access more of such content! Thanks again!

No comments:

Post a Comment