PHPackages                             lstrojny/pistis - 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. lstrojny/pistis

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

lstrojny/pistis
===============

Controlled pseudo-randomness and time for PHP

v0.4(8y ago)1212MITPHP

Since Nov 9Pushed 7y ago1 watchersCompare

[ Source](https://github.com/lstrojny/pistis)[ Packagist](https://packagist.org/packages/lstrojny/pistis)[ RSS](/packages/lstrojny-pistis/feed)WikiDiscussions master Synced 1mo ago

READMEChangelogDependencies (3)Versions (5)Used By (0)

Pistis - Controlled pseudo-randomness and time for PHP [![Build Status](https://camo.githubusercontent.com/71731bd0cb442e620e85499804317d5a1dd0dd46fd81211b5828daf891eb8c84/68747470733a2f2f7472617669732d63692e6f72672f6c7374726f6a6e792f7069737469732e7376673f6272616e63683d6d6173746572)](https://travis-ci.org/lstrojny/pistis)
===================================================================================================================================================================================================================================================================================================================================

[](#pistis---controlled-pseudo-randomness-and-time-for-php-)

Pseudo-randomness
-----------------

[](#pseudo-randomness)

Code generation often uses random identifiers / numbers to generate identifiers that are free of collisions. These random identifiers make reproducable builds impossible since there is no way to make the randomness deterministic.

To avoid that, **pistis** provides a simple interface to pseudo-random numbers and hexadecimal strings that can be used as part of identifiers enabling reproducable builds. Pistis allows passing a previous seed as an environment variable `PISTIS_SEED` for a second run.

Time
----

[](#time)

A second source of quasi randomness is time. Time info can be received by calling functions like `time()`. By replacing those functions with `Pistis\Clock::unixTimestamp()` one can fixate time for reproducible builds.

```
