PHP code example of jsnlib / rand

1. Go to this page and download the library: Download jsnlib/rand 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/ */

    

jsnlib / rand example snippets



$rand = new Jsnlib\Rand;

$rand->get(5, [1, 2, 3])[0];
// => 1x3DX

// 取得10筆亂數
$result = $rand->get(10, [1, 2, 3], 10);
foreach ($result as $val) 
{
    echo $val."<br>";
}
// => 
// SL47CUGOPq
// Y1pTRHLXIj
// nkKhGd9f57
// lfX7s1qwYs
// Z788ZARX9g
// 9YcCLzh0lU
// 1k10G9Z5b1
// wef8i9JLf3
// 3x969P4ie8
// o5K00e0c4I