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 (3 months ago) RSS 2.0 feedNot enough user ratingsTotal: 103 All time: 9,343 This week: 291Up
Version License PHP version Categories
generateuniquesnumbe 1.0.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.

Picture of Elminson De Oleo
  Performance   Level  
Name: Elminson De Oleo <contact>
Classes: 5 packages by
Country: United States United States
Age: 40
All time rank: 2585328 in United States United States
Week rank: 126 Up7 in United States United States Up
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

  Files folder image Files  /  src  
File Role Description
Files folder imageElminson (1 file)

  Files folder image Files  /  src  /  Elminson  
File Role Description
  Plain text file GenerateUniquesNumbers.php Class Class source

  Files folder image Files  /  tests  
File Role Description
  Accessible without login Plain text file test.php Example Example script
  Plain text file testGenerateUniquesNumbers.php Class Class source

 Version Control Unique User Downloads Download Rankings  
 85%
Total:103
This week:0
All time:9,343
This week:291Up

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