ZaynerTech

Poisson Twitter Followers

Feb 8th, 2013
180
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. #!/usr/bin/perl
  2. #
  3. # Script for number for modelling twitter follower increase using a Poisson distribution
  4. # http://zaynertech.blogspot.com
  5. #
  6.  
  7. my %val = ();
  8.  
  9. #hard coded values for Poisson distribution
  10. @counts = qw(0 1 2 3 4 5 6 7 8 9 10 11 12);
  11. @countsprob = qw(0.67 3.37 8.42 14.04 17.55 17.55 14.62 10.44 6.53 3.63 1.81 0.82 0.34);
  12.  
  13. # starting number of followers
  14. $total = 6622356;
  15.  
  16. open(FILER, ">", "calc.dist");
  17.  
  18. #7344 is total time divided by 64 seconds per 5 counts
  19.  
  20. for($x = 0; $x <7344; $x++)
  21. {
  22.  
  23.   $rnum = rand(10000);
  24.   $tots = 0;
  25.   for($y = 0; $y < 12; $y++)
  26.   {
  27.     $tots = $tots + (100 *$countsprob[$y]);
  28.    
  29.     if($rnum <= $tots){ $val{$x} = $counts[$y]; last;}
  30.   }
  31.   $total = $total + $val{$x};
  32.   $realx = $x *64;
  33.   print FILER "$realx $total\n";
  34.  
  35.  
  36. }
  37.  
  38. close(FILER);
RAW Paste Data