PHP code example of tkjn / phprandom

1. Go to this page and download the library: Download tkjn/phprandom library. Choose the download type require.

2. Extract the ZIP file and open the index.php.

3. Add this code to the index.php.
    
        
<?php
require_once('vendor/autoload.php');

/* Start to develop here. Best regards https://php-download.com/ */

    

tkjn / phprandom example snippets


$random = new \Tkjn\Random\Integer\XorshiftStar();

// Generate random value between 10 and 100 (inclusive)
$randomNumber = $random->rand(10, 100);

$random1 = new \Tkjn\Random\Integer\XorshiftStar(123);
$random2 = new \Tkjn\Random\Integer\XorshiftStar(123);
$random3 = new \Tkjn\Random\Integer\XorshiftStar(85874);

var_dump($random1->rand(10, 90));
var_dump($random2->rand(10, 90));
var_dump($random3->rand(10, 90));

var_dump($random1->rand(10, 90));
var_dump($random2->rand(10, 90));
var_dump($random3->rand(10, 90));