Пример #1
0
 public static function fisherYates($data)
 {
     $size = count($data);
     foreach ($data as $k => $v) {
         $index = Math::randomInterval(0, $size);
         self::swap($data, $k, $index);
     }
     return $data;
 }
Пример #2
0
 public static function newId()
 {
     usleep(Math::randomInterval(2, 4) * 100);
     for ($i = 0; $i < Math::randomInterval(2, 5); $i++) {
         usleep(100);
         session_regenerate_id(TRUE);
         usleep(100);
     }
     usleep(Math::randomInterval(2, 4) * 100);
     return self::id();
 }
Пример #3
0
 public function __construct($width = 400, $height = 200)
 {
     parent::__construct();
     if (!Validator::isNumber($width) || Validator::isNumber($height)) {
         throw new IllegalArgumentException();
     }
     $this->captcha = new Images($width, $height);
     $this->captcha->setBackgroundColor(new Color(0, 0, 0));
     $this->captcha->setTextColor(new Color(255, 255, 255));
     $string = new StringW(Hash::r());
     $this->text = $string->subString(0, Math::randomInterval(6, 8));
     $this->captcha->setText(Math::randomInterval(2, 6), new Point(0, 0), $string, FALSE);
 }
Пример #4
0
 public static function rNum()
 {
     return Math::randomInterval(0, Math::randomInterval(1, Math::randomInterval(2, 1000)));
 }