MATLAB OR C As RUID just leave in the program RUID 9 numbers
MATLAB OR C++
As RUID, just leave in the program RUID (9 numbers)
Write a program to simulate coin tosses. Probability of heads in a coin toss experiment is p where p is equal to the average of the numbers in your RUID divided by 10. Generate a figure which plots the frequency of heads f(n)in n coin tossing where f is shown on y-axis and n is on x-axis. Frequency of heads f(n)is computed as the number of heads observed within n trials divided by n. See the example below.Solution
#include \"koolplot.h\"
 #include <cstdlib>
 #include <iostream>
 #include <ctime>
 using namespace std;
 #define HEADS 0
 #define TAILS 1
int rand_int() {
return (int)(100.0 * rand() / (RAND_MAX + 1.0)) + 1;
 }
int getHeads(int n)
 {
 int tosses = 0, heads = 0, tails = 0; //init tosses and number of user defined tosses
while (tosses < min) {
 tosses++;
 if (rand_int() <= 55)
 heads++;
 else
 tails++;
 }
//prints results of tosses
 cout << \"Number of heads: \" << heads << endl;
 cout << \"Number of tails: \" << tails << endl;   
return heads;
 }
int main()
 {
Plotdata x(1, 100), y = getHeads(x)/100;
 plot(x, y)
return 0;
 }
Please download koolplot.h library before running this program As this library is needed for graph plot.

