PHP Lottery-Br Package: RANDOM NUMBER GENERATOR

Tiago Cavalcante Pereira
2 min readMay 27, 2021

(click here for Portuguese)

Lottery-Br is a package in PHP, which at first aims to generate random numbers for lottery games, can also be used to create other types of sweepstakes, that is, the developer is free to create his own methods.

Imagine a situation where multiple customers decide to deploy the same feature on their sites, in this case a random number generator for lottery games. Starting from that thought, I come to the question, can what I develop for one client also serve other? In this hypothetical situation, yes.

Lottery-Br features

Example: Generating random numbers for Mega-Sena games (Brazil)

 $game = new LotteryBr();
$game->megaSena(6,2);

Result: random numbers

Example: Create a new game rule

Let’s say you want to create a game with the following number sets [20,21,22,23,24,25,26,27,28,29,30] which the user must choose only three dozens, and this user decides to play 2 tickets. In this scenario, it is necessary to call the following function and insert the rule, example:

  $pattern = new LotteryPattern();
$pattern->makeGame(20, 30, 3, 2);

Result: random numbers

   /** result:
[
[0]=> [20,21,26]
[1]=> [26,27,29]
]
**/

Project source code (Lottery-Br)

Example of a project using Lottery-Br

Source code:

--

--