Professional Documents
Culture Documents
New Format EXPERIMENT 1.1 M&S LAB (19BCS2700 ROHIT SHARMA)
New Format EXPERIMENT 1.1 M&S LAB (19BCS2700 ROHIT SHARMA)
Experiment: 1.1
Aim: Write a program to implement a random number generator
Description: Random generator is used to generate the random number as per the functions
provided. Use the rand, randn, and randi functions to create sequences of pseudorandom numbers, and
the randperm function to create a vector of randomly permuted integers.
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:
1. rand(): This function returns the random number without
>>rand()
numbers.
>>rand(3,4)
>>randi(6) or randi(2,5)
>>randperm(5)
Output:
1.
2.
3.
4.
6.