ZaynerTech

Test your ability to memorize X random digits

Mar 24th, 2013
102
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. #!/usr/bin/perl
  2. #
  3. # Usage: ./braintest.pl <# of digits>
  4. #
  5. #
  6. # Change rand(10) to rand(2) to do binary
  7. # sleep(15) allows 15 seconds to memorize obviously for longer strings much more time will be needed.
  8. #
  9.  
  10.  
  11. for($x = 0; $x < $ARGV[0]; $x++)
  12. {
  13.    $num = int(rand(10));
  14.    $bin = $bin.$num;
  15. }
  16.    print "$bin\n";
  17. sleep(15);
  18. for($x = 0; $x < 1000; $x++){print "\n"; }
  19.  
  20. print "Enter number: ";
  21. $test = <STDIN>;
  22. chomp($test);
  23.  
  24. if($test == $bin) { print "Correct!\n"; }
  25. else { print "Wrong $bin\n";}
RAW Paste Data