#Hi First practice for PR class use warnings ; use strict ; use GD::Graph::linespoints ; #use DBI ; #use utf8 ; #use Encode ; #my \$sfile = '/root/source.txt' ; print 'First Number > ' ; chomp(my \$A = ) ; print 'Second Number > ' ; chomp(my \$B = ) ; #my @range = (\$A..\$B) ; #my \$rndn = \$range[int (rand(@range))] ; my @points = () ; my \$counter = 0 ; while (\$counter <= 999) { my \$rndn = \$A + (int rand(\$B - \$A + 1)); push (@points,\$rndn) ; \$counter++ ; } #Calculate the Mean and Variance my \$running_sum = 0; my \$meansum ; my \$vari ; my \$element1 ; my \$element2 ; foreach \$element1 (@points) { \$meansum += \$element1; } my \$mean = \$meansum/1000 ; print "MEAN = \$mean" , "\n" ; foreach \$element2 (@points) { \$vari += ((\$meansum - \$element2)^2) ; } my \$variance = (\$vari/1000) ; print "Variance = \$variance" , "\n" ; print 'Second Number > ' ; chomp(my \$xi = ) ; my \$Gs1 = (1/sqrt(2*3.14*\$variance)) ; my \$Gs2 = 2.718^(-((\$xi - \$mean)^2)/(2*\$variance)) ; my \$Go = \$Gs1 * \$Gs2 ; print "\$Gs1" , "\n" ; print "\$Gs2" , "\n" ; print "\$Go" , "\n" ; my \$graph = new GD::Graph::linespoints(2000 , 2000) ; \$graph->set( x_label => 'Points' , x_label_skip => 1 , y_label => 'Number' , y_label_skip => 1 , title => 'Time Vs Fee') or warn \$graph->error ; \$graph->plot(\@points); open OUT,'>','FirstPracticeTest.jpeg' or die "\$!"; binmode OUT; print OUT \$graph->gd->jpeg;