PHPackages                             tkjn/phprandom - PHPackages - PHPackages  [Skip to content](#main-content)[PHPackages](/)[Directory](/)[Categories](/categories)[Trending](/trending)[Leaderboard](/leaderboard)[Changelog](/changelog)[Analyze](/analyze)[Collections](/collections)[Log in](/login)[Sign up](/register)

1. [Directory](/)
2. /
3. [Utility &amp; Helpers](/categories/utility)
4. /
5. tkjn/phprandom

ActiveLibrary[Utility &amp; Helpers](/categories/utility)

tkjn/phprandom
==============

Random data generation

v2.0.0(9y ago)28PHPPHP ^7.1

Since Mar 8Pushed 9y ago1 watchersCompare

[ Source](https://github.com/tkjn/phprandom)[ Packagist](https://packagist.org/packages/tkjn/phprandom)[ RSS](/packages/tkjn-phprandom/feed)WikiDiscussions master Synced 2mo ago

READMEChangelog (1)Dependencies (1)Versions (5)Used By (0)

PHP Random
==========

[](#php-random)

[![Build Status](https://camo.githubusercontent.com/3b1f8450d833424f980186e409535cc4923c44b73742b80e34c5490f4c838539/68747470733a2f2f7472617669732d63692e6f72672f746b6a6e2f70687072616e646f6d2e7376673f6272616e63683d6d6173746572)](https://travis-ci.org/tkjn/phprandom)

The purposes of this library are:

- Provide a self-contained seeded number generator object, which doesn't rely on global state for the seed
- Define interfaces for random data generation that can be type-hinted and are easy to mock when unit testing.

Installation
------------

[](#installation)

Require `tkjn/phprandom` in composer.json

Usage
-----

[](#usage)

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

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

Multiple instances will maintain their own seed unlike the built-in php `rand()` and `mt_rand()` which are seeded globally

```
$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));
```

Results in

```
int(59)
int(59)
int(13)

int(84)
int(84)
int(15)

```

###  Health Score

26

—

LowBetter than 43% of packages

Maintenance20

Infrequent updates — may be unmaintained

Popularity7

Limited adoption so far

Community7

Small or concentrated contributor base

Maturity61

Established project with proven stability

 Bus Factor1

Top contributor holds 100% of commits — single point of failure

How is this calculated?**Maintenance (25%)** — Last commit recency, latest release date, and issue-to-star ratio. Uses a 2-year decay window.

**Popularity (30%)** — Total and monthly downloads, GitHub stars, and forks. Logarithmic scaling prevents top-heavy scores.

**Community (15%)** — Contributors, dependents, forks, watchers, and maintainers. Measures real ecosystem engagement.

**Maturity (30%)** — Project age, version count, PHP version support, and release stability.

###  Release Activity

Cadence

Every ~357 days

Total

3

Last Release

3369d ago

Major Versions

v0.1.0 → v1.0.02017-01-08

v1.0.0 → v2.0.02017-02-21

### Community

Maintainers

![](https://www.gravatar.com/avatar/a4e041b840494243253914af29f92259f3fd9ab74ca5c1d7bc69c5c1161a1fa4?d=identicon)[tkjn](/maintainers/tkjn)

---

Top Contributors

[![tkjn](https://avatars.githubusercontent.com/u/1941262?v=4)](https://github.com/tkjn "tkjn (29 commits)")

###  Code Quality

TestsPHPUnit

### Embed Badge

![Health badge](/badges/tkjn-phprandom/health.svg)

```
[![Health](https://phpackages.com/badges/tkjn-phprandom/health.svg)](https://phpackages.com/packages/tkjn-phprandom)
```

###  Alternatives

[yohang/calendr

Object Oriented calendar management

465614.1k3](/packages/yohang-calendr)[codelicia/xulieta

Xulieta is a light php binary that lint documentation snippets

6713.3k5](/packages/codelicia-xulieta)[innoge/filament-form-faker

A package to generate fake input data for Filament forms.

162.5k](/packages/innoge-filament-form-faker)[digitoimistodude/dude-most-read-posts

A developer-friendly plugin to count most read posts

162.4k](/packages/digitoimistodude-dude-most-read-posts)

PHPackages © 2026

[Directory](/)[Categories](/categories)[Trending](/trending)[Changelog](/changelog)[Analyze](/analyze)
