Want more features on Pastebin? Sign Up, it's FREE!
Guest

Untitled

By: a guest on Jun 6th, 2013  |  syntax: None  |  size: 0.81 KB  |  views: 32  |  expires: Never
download  |  raw  |  embed  |  report abuse  |  print
Text below is selected. Please press Ctrl+C to copy to your clipboard. (⌘+C on Mac)
  1. <?php
  2. /*
  3. * FILE DOCBLOCK
  4. */
  5. /*
  6.  * NAME SPACE DOCBLOCK
  7.  */
  8. namespace limber\core;
  9.  
  10. /**
  11.  * Number manipulation class
  12.  *
  13.  * This class handles any methods that are used
  14.  * to manipulate numbers
  15.  *
  16.  * @version 1.0
  17.  * @package core
  18.  * @category class
  19.  * @author MY NAME
  20.  * @license MIT http://opensource.org/licenses/MIT
  21.  */
  22. class Num
  23. {
  24.     /**
  25.      * Random number generator
  26.      *
  27.      * @param $length int The length of the number required
  28.      * @return $num int A random number
  29.      * @author Unknown
  30.      */
  31.     public static function random($length = 8)
  32.     {
  33.         $characters = "0123456789abcdefghijklmnopqrstuvwxyz";
  34.         $num = "";
  35.         for ($p = 0; $p < $length; $p++) {
  36.             $num .= $characters[mt_rand(0, strlen($characters))];
  37.         }
  38.         return $num;
  39.     }
  40. }
clone this paste RAW Paste Data