PHP Classes

Generate a list of unique numbersPHP Unique Number Generator: generateUniquesNumbers

Recommend this page to a friend!
  Info   View files Example   View files View files (7)   DownloadInstall with Composer Download .zip   Reputation   Support forum   Blog    
Last Updated Ratings Unique User Downloads Download Rankings
2020-04-16 (7 days ago) RSS 2.0 feedNot yet rated by the usersTotal: Not yet counted Not yet ranked
Version License PHP version Categories
generateuniquesnumbe 1.0GNU General Publi...5PHP 5, Statistics, Math
Description Author

This class can generate a list of unique numbers.

It can generate an array of random integer numbers that are unique between themselves.

The class may exclude a given list of numbers from those that are generated.

  Performance   Level  
Innovation award
Innovation award
Nominee: 2x

 

Details

generateUniquesNumbers

<?php 

require_once __DIR__ . '/vendor/autoload.php'; // Autoload files using Composer autoload

use Elminson\GenerateUniquesNumbers;

$array = [1, 2, 3, 4];

$gen = new generateUniqueNumbers();

$gen->setMax(10);

$gen->setExclude($array);

$gen->setTopRandomNumber(5);

$gen->generate();

print_r($gen->getCurrentNumbers());

//Output
Array
(
    [0] => 0
    [1] => 9
    [2] => 6
    [3] => 10
    [4] => 5
)

  Files folder image Files  
File Role Description
Files folder imagesrc (1 directory)
Files folder imagetests (2 files)
Accessible without login Plain text file composer.json Data Auxiliary data
Accessible without login Plain text file composer.lock Data Auxiliary data
Accessible without login Plain text file README.md Doc. Documentation
Accessible without login Plain text file test.php Example Test file

 Version Control Unique User Downloads  
 85%
Total:0
This week:0

For more information send a message to info at phpclasses dot org.