{"id":13806324,"url":"https://github.com/libmir/mir-random","last_synced_at":"2026-02-13T16:06:03.149Z","repository":{"id":45082669,"uuid":"74410870","full_name":"libmir/mir-random","owner":"libmir","description":"Advanced Random Number Generators","archived":false,"fork":false,"pushed_at":"2024-12-17T18:38:23.000Z","size":1574,"stargazers_count":32,"open_issues_count":2,"forks_count":16,"subscribers_count":10,"default_branch":"master","last_synced_at":"2025-03-24T01:17:28.940Z","etag":null,"topics":["dub","mir-random","phobos","random","random-generation","rng","tinflex"],"latest_commit_sha":null,"homepage":"http://mir-random.libmir.org/","language":"D","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":null,"status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/libmir.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":null,"code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2016-11-21T22:18:49.000Z","updated_at":"2024-12-17T18:38:22.000Z","dependencies_parsed_at":"2025-01-29T07:30:50.613Z","dependency_job_id":"77f86541-8e7c-4120-b5cf-391dc1e97728","html_url":"https://github.com/libmir/mir-random","commit_stats":null,"previous_names":[],"tags_count":67,"template":false,"template_full_name":null,"purl":"pkg:github/libmir/mir-random","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/libmir%2Fmir-random","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/libmir%2Fmir-random/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/libmir%2Fmir-random/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/libmir%2Fmir-random/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/libmir","download_url":"https://codeload.github.com/libmir/mir-random/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/libmir%2Fmir-random/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":273782394,"owners_count":25167130,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","status":"online","status_checked_at":"2025-09-05T02:00:09.113Z","response_time":402,"last_error":null,"robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":true,"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":["dub","mir-random","phobos","random","random-generation","rng","tinflex"],"created_at":"2024-08-04T01:01:10.224Z","updated_at":"2026-02-13T16:05:58.117Z","avatar_url":"https://github.com/libmir.png","language":"D","funding_links":[],"categories":["Scientific"],"sub_categories":["XML"],"readme":"[![Dub version](https://img.shields.io/dub/v/mir-random.svg)](http://code.dlang.org/packages/mir-random)\n[![Dub downloads](https://img.shields.io/dub/dt/mir-random.svg)](http://code.dlang.org/packages/mir-random)\n[![License](https://img.shields.io/dub/l/mir-random.svg)](http://code.dlang.org/packages/mir-random)\n\n[![Circle CI](https://circleci.com/gh/libmir/mir-random.svg?style=svg)](https://circleci.com/gh/libmir/mir-random)\n[![Build Status](https://travis-ci.org/libmir/mir-random.svg?branch=master)](https://travis-ci.org/libmir/mir-random)\n[![Build status](https://ci.appveyor.com/api/projects/status/github/libmir/mir-random?svg=true)](https://ci.appveyor.com/project/9il/mir-random/branch/master)\n[![Gitter](https://img.shields.io/gitter/room/libmir/public.svg)](https://gitter.im/libmir/public)\n\n\n# mir-random\nAdvanced Random Number Generators\n\nDocumentation - http://mir-random.libmir.org/\n\nThis library is for general-purpose random number generation. Do not use it for cryptography or secret generation.\n\n### Example (3 seconds)\n```d\nvoid main()\n{\n    import mir.random;\n    import mir.random.variable: normalVar;\n    import mir.random.algorithm: randomSlice;\n\n    auto sample = normalVar.randomSlice(10);\n\n    import std.stdio;\n    sample[$.randIndex].writeln;\n}\n```\n\n\u003c!-- [![Open on run.dlang.io](https://img.shields.io/badge/run.dlang.io-open-blue.svg)](https://run.dlang.io/is/mTVJL6) --\u003e\n\n\n### Example (10 seconds)\n```d\nvoid main()\n{\n    import mir.random;\n    import mir.random.variable: normalVar;\n    import mir.random.algorithm: randomSlice;\n\n    // Engines are allocated on stack or global\n    auto rng = Random(unpredictableSeed);\n    auto sample = rng.randomSlice(normalVar, 10);\n\n    import std.stdio;\n    sample[rng.randIndex($)].writeln;\n}\n```\n\n\u003c!-- [![Open on run.dlang.io](https://img.shields.io/badge/run.dlang.io-open-blue.svg)](https://run.dlang.io/is/F1Iucp) --\u003e\n\n\n## Comparison with Phobos\n - Does not depend on DRuntime (Better C concept)\n\n##### `random` (new implementation and API)\n - Mir Random `rand!float`/`rand!double`/`rand!real` generates saturated real random numbers in `(-1, 1)`. For example, `rand!real` can produce more than 2^78 unique numbers. In other hand, `std.random.uniform01!real` produces less than `2^31` unique numbers with default Engine.\n - Mir Random fixes Phobos integer underflow bugs.\n - Additional optimization was added for enumerated types.\n - Random [nd-array (ndslice)](https://github.com/libmir/mir-algorithm) generation.\n - Bounded integer generation in `randIndex` uses Daniel Lemire's fast alternative to modulo reduction. The throughput increase measured for `randIndex!uint` on an x86-64 processor compiled with LDC 1.6.0 was 1.40x for `Mt19937_64` and 1.73x for `Xoroshiro128Plus`. The throughput increase measured for `randIndex!ulong` was 2.36x for `Mt19937_64` and 4.25x for `Xoroshiro128Plus`.\n\n##### `random.variable` (new)\n - Uniform\n - Exponential\n - Gamma\n - Normal\n - Cauchy\n - ...\n\n##### `random.ndvariable` (new)\n - Simplex\n - Sphere\n - Multivariate Normal\n - ...\n\n##### `random.algorithm` (new)\n - Ndslice and range API adaptors\n\n##### `random.engine.*` (fixed, reworked, new)\n - `opCall` API instead of range interface is used (similar to C++)\n - No default and copy constructors are allowed for generators.\n - `unpredictableSeed` has not state, returns `size_t`\n - `unpredictableSeed!UIntType` overload for seeds of any unsigned type (merged to Phobos)\n - Any unsigned generators are allowed.\n - `min` property was removed. Any integer generator can normalize its minimum down to zero.\n - Mt19937: +100% performance for initialization. (merged to Phobos)\n - Mt19937: +54% performance for generation. (merged to Phobos)\n - Mt19937: fixed to be more CPU cache friendly. (merged to Phobos)\n - 64-bit Mt19937 initialization is fixed (merged to Phobos)\n - 64-bit Mt19937 is default for 64-bit targets\n - Permuted Congruential Generators (new)\n - SplitMix generators (new)\n - Fixed XorshiftEngine's support for non-`uint` word sizes \u0026 allow various shift directions (merged to Phobos)\n - XorshiftStar Generators (new)\n - Xoroshiro128Plus generator (new)\n - Xoshiro256StarStar \u0026 Xoshiro128StarStar_32 generators (new)\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Flibmir%2Fmir-random","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Flibmir%2Fmir-random","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Flibmir%2Fmir-random/lists"}