Download as pdf or txt
Download as pdf or txt
You are on page 1of 2

Course Name: Modelling and Simulation Lab Course code: CSP-443

Experiment: 1.3
Aim: To implement testing of Random numbers (Chi Square)

Tools/Software Required: Matlab Mathworks, Personal Computer

Description: A random number is a number generated using a large set of numbers and a mathematical
algorithm which gives equal probability to all numbers occurring in the specified distribution. Random
numbers are most commonly produced with the help of a random number generator. One of the most
important prerequisites of a random number is to be independent and uniformly distributed. There are
two types of random numbers:
• True Random number: A number selected from a range with equal chance of all numbers in the
range being selected via an unpredictable method.
• Pseudo-Random number: An approximation of a random number created by a biased or
deterministic process.
Here, h=chi2gof(x);

chi2gof: Returns the test decision for the Null hypothesis that the data in vector x comes from a normal distribution
with a mean and variance estimates from x.
Hypothesis: Checks the randomness of the numbers generated through random number generator.

Mean: The mean is the average or the most common value in a collection of numbers. In
statistics, it is a measure of central tendency of a probability distribution along median and
mode. It is also referred to as an expected value.

Variance: The term variance refers to a statistical measurement of the spread between numbers in a
data set. More specifically, variance measures how far each number in the set is from the mean
(average), and thus from every other number in the set.

Pseudo code/Algorithms/Flowchart/Steps:
1. Open Matlab Mathworks
2. Create a new file
3. Implement the code
4. Save the file and run the code

Implementation:

Name: Rohit Sharma UID: 19BCS2700


x = randn(150,1);

h = chi2gof(x)

mean(x)

var(x)

Output:

Name: Rohit Sharma UID: 19BCS2700

You might also like