Wednesday, May 24, 2017

Randomnes Tester - Ver 3 - C Sharp

Randomnes Tester ver 3
(Written by me in c#)
.
      Some years ago while working in beautiful Borland Turbo C and using Random numbers, for doing something, I thought why not test how many times any number comes in a list of Random numbers. So I then made a C program for testing that. At watching result of that program I was a little surprised.
      In first version that program generated 100 random numbers and displayed them on screen/CRT. i was surprised to see that some numbers were generated more then once and some never. So I made another version of that program  and I changed it's working a little from first one. Now although it was still generating random numbers between 0 and 99 but a lot of time and was storing how many times a number was getting generated in a array of 100 elements. In fact it was generating random numbers multiple of 100 times between 0 and 99. Now again I was surprised to see it's result. This time almost all numbers were generated 1 percent of times. All of this looked very interesting to me.
      Few months ago I planned/decided to put that program on my this blog but because that program was in Pentium 3 and because that Pentium 3 is no longer working so after thinking and thinking I made that program in c# in visual-studio 2010 for putting/sharing on my this blog. I named this new application 'RandomnesTester'.
      It's user interface is simple and easy to use. At top right it shows a button with text 'Help'. Click this button for viewing Help information about this application. Next to 'Random number count' enter how many random number are required. It is a UInt32 field. Next to it is 'Max value' button. Click it to get  max number entered in 'Random number count' field automatically. Helpful alert messages will display on invalid inputs. Click 'Start' button for starting process. Click 'Stop' button for stoping/cancelling process any time while it is running. On success result will display Under 'Randomnes Test Result'. Column 'Number' will show all numbers it generates from 0 to 99. Column 'Count' will show how many times each number is generated. Column 'Percentage' will show how many percent of times a number is generated. Under these is footer. Footer will show total numbers in 'Number' column under 'Number' column, total of 'Count' column under 'Count' column and total of 'Percentage' column under 'Percentage' column.   Different text messages will show in bottom left telling what application is doing. Process status will show in text in bottom left and in progressbar in bottom right.
.

      Following are the screen shots of 'RandomnessTester' version 3 application with explanation.
.
Application looks like this when it is loaded.
.

.
This is application's Help screen. It displays basic information about application under 'About' section, purpose under 'Purpose' section and how to use under 'How to Use' section.
.

.
If input number is not valid then application displays this alert message giving user 2 options as discribed in it.
.

.
This alert message is displayed when input number is not multiple of 100 telling it will be made so.
.

.
Application looks like this when (1st) Valid number in entered , (2nd) 'Start' button is clicked and (3rd) It begin processing. During processing helpfull information is displayed in status line at bottom
.

.
Application looks like this when during processing 'Stop' button is pressed, Cancelling process. Helpfull information is displayed in status line at bottom
.

.
Application looks like this when processing ends successfully, Helpfull information is displayed in status line at bottom
.

.
      In above image result of process is displayed under 'Randomnes Test Result'. And from this it can be observed that all numbers betwen 0 and 99 are generated near 1 percent of times.
.

      Enjoy Complete Source code of application written and compiled in visual studio 2010 Ultimate by me. Download it. Extract it. Read 'ReadMeFirst.txt' file and do as is explained in it.
.


No comments:

Post a Comment