<?phpclass Rast {protected $sonuc, $ciz, $mikro, $sn, $f, $m, $tam;public function gele($sayi2=100,$sayi1=0,$sayi=0, $mutlak=true, $ciz=false) {$sayi2++;$this->ciz = microtime();list($this->mikro, $this->sn) = explode(" ", $this->ciz);$this->ciz = ' - '.$this->ciz;$this->f = '';$this->m = 1;if ($sayi > 0) {$sayi2--; $this->f = '.'.$this->gele(pow(10, $sayi));}if ($ciz === false) { $this->ciz = '';}if ($mutlak === false) { $this->m = $this->gele(2) == 0 ? -1 : 1; }$this->mikro = pow($this->mikro, 2) + $this->mikro +41; // according sayi2 Euler's formula$this->sn = pow($this->sn, 2) + $this->sn +41;$this->tam = strlen($sayi2) +substr($this->mikro, 0, 2) +2;$this->sonuc = sprintf("%.{$this->tam}f", ($this->mikro/$this->sn));$this->sonuc = ((((substr($this->sonuc, (strlen($sayi2) > 3 ? (5+strlen($sayi2))*(-1) : -5)) % ($sayi2-$sayi1)) + $sayi1).$this->f)*$this->m).$this->ciz;return $this->sonuc;}}$rast = new Rast();echo $rast->gele(5);//0 ile 5 arası rastgele pozitif sayılarecho "<br>";echo $rast->gele(15, 4);//4 ile 15 arası rastgele pozitif sayılarecho "<br>";echo $rast->gele(15, 0, 3);//0 ile baslanyan ve virgülden sonra 3 haneli sayıecho "<br>";echo $rast->gele(15, 4, 3);//4 ile baslanyan ve virgülden sonra 3 haneli sayıecho "<br>";echo $rast->gele(15, 0, 0, false);//0echo "<br>";echo $rast->gele(15, 0, 3, false);//0echo "<br>";echo $rast->gele(15, 9, 0, false);//9 veya -9echo "<br>";echo $rast->gele(15, 9, 0, false, true);//9 veya -9echo "<br>";echo $rast->gele(15, 9, 0, true, true);//9 ile 15 arası sayı - mikrozaman ve zamandamgasıecho "<br>";echo $rast->gele(15, 0, 3, false, true);//0echo "<br>";?>
Çıktısı
0150.4054.85600-9-913 - 0.70984500 15283842710