{"id":44346585,"url":"https://github.com/clickalicious/rng","last_synced_at":"2026-02-11T14:06:14.598Z","repository":{"id":28804047,"uuid":"32327100","full_name":"clickalicious/rng","owner":"clickalicious","description":"The secure Pseudo Random Number Generator PRNG for PHP.","archived":false,"fork":false,"pushed_at":"2018-05-29T16:08:25.000Z","size":2958,"stargazers_count":1,"open_issues_count":1,"forks_count":4,"subscribers_count":3,"default_branch":"master","last_synced_at":"2025-07-02T15:55:24.826Z","etag":null,"topics":["php","prng","random-bytes","random-number-generator","random-number-generators","rng"],"latest_commit_sha":null,"homepage":"http://clickalicious.github.io/rng","language":"PHP","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/clickalicious.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2015-03-16T13:35:09.000Z","updated_at":"2024-05-23T00:30:16.000Z","dependencies_parsed_at":"2022-09-05T01:20:10.181Z","dependency_job_id":null,"html_url":"https://github.com/clickalicious/rng","commit_stats":null,"previous_names":[],"tags_count":81,"template":false,"template_full_name":null,"purl":"pkg:github/clickalicious/rng","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/clickalicious%2Frng","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/clickalicious%2Frng/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/clickalicious%2Frng/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/clickalicious%2Frng/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/clickalicious","download_url":"https://codeload.github.com/clickalicious/rng/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/clickalicious%2Frng/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":29334025,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-02-11T12:42:24.625Z","status":"ssl_error","status_checked_at":"2026-02-11T12:41:23.344Z","response_time":97,"last_error":"SSL_connect returned=1 errno=0 peeraddr=140.82.121.5:443 state=error: unexpected eof while reading","robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":false,"can_crawl_api":true,"host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["php","prng","random-bytes","random-number-generator","random-number-generators","rng"],"created_at":"2026-02-11T14:06:13.932Z","updated_at":"2026-02-11T14:06:14.586Z","avatar_url":"https://github.com/clickalicious.png","language":"PHP","readme":"\u003cimg src=\"https://avatars0.githubusercontent.com/u/26927954?v=3\u0026s=80\" align=\"right\" /\u003e\n\n---\n\n![Logo of rng](docs/logo-large.png)\n\nThe secure **Pseudo Random Number Generator** `PRNG` for PHP.\n\n| [![Build Status](https://travis-ci.org/clickalicious/rng.svg?branch=master)](https://travis-ci.org/clickalicious/rng) \t| [![Codacy branch grade](https://img.shields.io/codacy/grade/f53e4682e6524d44aedb454adce68a18/master.svg)](https://www.codacy.com/app/clickalicious/rng?utm_source=github.com\u0026utm_medium=referral\u0026utm_content=clickalicious/rng\u0026utm_campaign=Badge_Grade)\t| [![Codacy coverage](https://img.shields.io/codacy/coverage/f53e4682e6524d44aedb454adce68a18.svg)](https://www.codacy.com/app/clickalicious/rng?utm_source=github.com\u0026utm_medium=referral\u0026utm_content=clickalicious/rng\u0026utm_campaign=Badge_Grade) \t| [![clickalicious open source](https://img.shields.io/badge/clickalicious-open--source-green.svg?style=flat)](https://clickalicious.de/) \t|\n|---\t|---\t|---\t|---\t|\n| [![GitHub release](https://img.shields.io/github/release/clickalicious/rng.svg?style=flat)](https://github.com/clickalicious/rng/releases) \t| [![license](https://img.shields.io/github/license/mashape/apistatus.svg)](https://opensource.org/licenses/MIT)  \t| [![Issue Stats](https://img.shields.io/issuestats/i/github/clickalicious/rng.svg)](https://github.com/clickalicious/rng/issues) \t| [![Dependency Status](https://dependencyci.com/github/clickalicious/rng/badge)](https://dependencyci.com/github/clickalicious/rng)  \t|\n\n\n## Table of Contents\n\n- [Features](#features)\n- [Examples](#examples)\n- [Requirements](#requirements)\n- [Philosophy](#philosophy)\n- [Versioning](#versioning)\n- [Roadmap](#roadmap)\n- [Security-Issues](#security-issues)\n- [License »](LICENSE)\n\n\n## Features\n\n - Provides a secure `PRNG`: pseudo random number generator (64-Bit support) \n - OOP facade to PHP core functionality\n - High performance (developed using a profiler)\n - Lightweight and high-quality codebase (following PSR standards e.g. `PSR-1,2,4`)\n - Stable, clean + well documented code\n - Unit-tested with a good coverage\n\n\n## Examples\n\nGenerate `random number` between 1 and 10 using `OPEN_SSL` random bytes (library default):\n```php\n$generator = new \\Clickalicious\\Rng\\Generator();\n$number    = $generator-\u003egenerate(1, 10);\necho $number;\n```\n\nGenerate `random number` between 1 and 10 using `PHP_MERSENNE_TWISTER` random bytes:\n```php\n$generator = new \\Clickalicious\\Rng\\Generator(\\Clickalicious\\Rng\\Generator::MODE_PHP_MERSENNE_TWISTER);\n$number    = $generator-\u003egenerate(1, 10);\necho $number;\n```\n\nGenerate `16 random bytes` using `MODE_OPEN_SSL` random bytes (library default):\n```php\n$generator = new \\Clickalicious\\Rng\\Generator();\n$bytes     = $generator-\u003egetRandomBytes(16);\n```\n\nGenerate `32 random bytes` using `NATIVE-PHP` random bytes:\n```php\n$generator = new \\Clickalicious\\Rng\\Generator();\n$bytes     = $generator-\u003egetRandomBytes(32);\n```\n\n\n### Visualization\n\nYou can create a visualization of randomization (as you can see below but larger size) through [`visual.php` »](visual.php) (the file is located in root). As you may see: The first square (light grey) is the default PHP random generated noise which is aligned by a pattern (you will see in the large version of the picture). The following three squares a generated using a more secure generator like Open-SSL for example. \n\n![Logo of rng](docs/visualization.png)\n\n\n## Requirements\n\n - `PHP \u003e= 5.6` (compatible up to version `7.2` as well as `HHVM`)\n\n\n## Philosophy\n\nThis library provides a state of the art `PRNG` (**P**seudo **R**andom **N**umber **G**enerator) implementation to generate secure `Pseudo Random Numbers` with PHP. The generation is either based on `Open SSL` or `MCrypt` or as fallback on PHP's internal functionality. The library also provides a very good `Seed generator` on puplic API. If you are interested in the difference between real and pseduo randomness then you could start at [https://www.random.org/randomness/](https://www.random.org/randomness/ \"https://www.random.org/randomness/\").\n\n[![Scott Adams](https://www.random.org/analysis/dilbert.jpg)](http://dilbert.com/strip/2001-10-25 \"Copyright Universal Uclick / Scott Adams\")\n\n`DILBERT © 2001 Scott Adams.`\n\n\n## Versioning\n\nFor a consistent versioning i decided to make use of `Semantic Versioning 2.0.0` http://semver.org. Its easy to understand, very common and known from many other software projects.\n\n\n## Roadmap\n\n- No open issues.\n\n[![Throughput Graph](https://graphs.waffle.io/clickalicious/rng/throughput.svg)](https://waffle.io/clickalicious/rng/metrics)\n\n\n## Security Issues\n\nIf you encounter a (potential) security issue don't hesitate to get in contact with us `opensource@clickalicious.de` before releasing it to the public. So i get a chance to prepare and release an update before the issue is getting shared. Thank you!\n\n\n## Participate \u0026 Share\n\n... yeah. If you're a code monkey too - maybe we can build a force ;) If you would like to participate in either **Code**, **Comments**, **Documentation**, **Wiki**, **Bug-Reports**, **Unit-Tests**, **Bug-Fixes**, **Feedback** and/or **Critic** then please let me know as well!\n\u003ca href=\"https://twitter.com/intent/tweet?hashtags=\u0026original_referer=http%3A%2F%2Fgithub.com%2F\u0026text=rng%20-%20Random%20number%20generator%20for%20PHP%20%40phpfluesterer%20%23rng%20%23php%20https%3A%2F%2Fgithub.com%2Fclickalicious%2Frng\u0026tw_p=tweetbutton\" target=\"_blank\"\u003e\n  \u003cimg src=\"http://jpillora.com/github-twitter-button/img/tweet.png\"\u003e\u003c/img\u003e\n\u003c/a\u003e\n\n## Sponsors\n\nThanks to our sponsors and supporters:\n\n| JetBrains | Navicat |\n|---|---|\n| \u003ca href=\"https://www.jetbrains.com/phpstorm/\" title=\"PHP IDE :: JetBrains PhpStorm\" target=\"_blank\"\u003e\u003cimg src=\"https://resources.jetbrains.com/assets/media/open-graph/jetbrains_250x250.png\" height=\"55\"\u003e\u003c/img\u003e\u003c/a\u003e | \u003ca href=\"http://www.navicat.com/\" title=\"Navicat GUI - DB GUI-Admin-Tool for MySQL, MariaDB, SQL Server, SQLite, Oracle \u0026 PostgreSQL\" target=\"_blank\"\u003e\u003cimg src=\"http://upload.wikimedia.org/wikipedia/en/9/90/PremiumSoft_Navicat_Premium_Logo.png\" height=\"55\" /\u003e\u003c/a\u003e  |\n\n\n###### Copyright\n\u003cdiv\u003eIcons made by \u003ca href=\"http://www.freepik.com\" title=\"Freepik\"\u003eFreepik\u003c/a\u003e from \u003ca href=\"http://www.flaticon.com\" title=\"Flaticon\"\u003ewww.flaticon.com\u003c/a\u003e is licensed by \u003ca href=\"http://creativecommons.org/licenses/by/3.0/\" title=\"Creative Commons BY 3.0\" target=\"_blank\"\u003eCC 3.0 BY\u003c/a\u003e\u003c/div\u003e\n","funding_links":[],"categories":[],"sub_categories":[],"project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fclickalicious%2Frng","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fclickalicious%2Frng","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fclickalicious%2Frng/lists"}