FreqTable with random values(#C)

Posted by Sef on Stack Overflow See other posts from Stack Overflow or by Sef
Published on 2010-03-30T13:21:02Z Indexed on 2010/03/30 13:23 UTC
Read the original article Hit count: 270

Filed under:

Hello,

I would like to make a frequency table with random numbers. So i have created a array that generates 11 random values between 0 and 9999.

        public void FillArrayRandom(int[] T)
    {
        Random Rndint = new Random();

        for (int i=0; i < T.Length; i++)
        {
            T[i] = Rndint.Next(0, 9999);
        }
    }/*FillArrayRandom*/

The result i want is something alike this:(bar height up to 21) So this will be a constant. * * * * * * (the highest value will have the largest row/bar) * * * * 0 1 2 3 .....(index value's) 931 6669 10 8899 .... (up to 11 random values)

My question is how do i exactly caculate the frequency between those 11 random values? The bars should have a relative relation with each other depending on there frequency. I would only like to use 1 single array in my program (for the generated values).

F = (F * 21?) / ...? Really no clue how to obtain the proper results.

If a frequency is >=21 write * If a frequency is >=20 write * If a frequency is >=19 write *

etc...

Regards.

© Stack Overflow or respective owner

Related posts about c#