Perl: random numbers, but less random
The tutor prepares for a statistics experiment. The first step is to generate two lists: one random, one less so.
To generate fifteen random numbers with Perl one can use the following code:
for ($i=0;$i<15;$i++){ $num=sprintf("%.0f",100*rand()); print $num; print " "; }
To generate fifteen somewhat less random numbers, one can add 5 to each output:
for ($i=0;$i<15;$i++){ $num=sprintf("%.0f",100*rand()+5); print $num; print " "; }
My plan is to compare these two lists, using the matched-pairs t-test (see my post from yesterday), to find if it can determine a difference between them.
Source:
McGrath, Mike. Perl in easy steps. Southam: Computer Step, 2004.
Jack of Oracle Tutoring by Jack and Diane, Campbell River, BC.
Leave a Reply
You must be logged in to post a comment.