{"id":21032855,"url":"https://github.com/jancvanb/roc-random","last_synced_at":"2025-03-13T20:12:49.833Z","repository":{"id":43182603,"uuid":"445351010","full_name":"JanCVanB/roc-random","owner":"JanCVanB","description":"🦅 🎲 Roc library for random number generation","archived":false,"fork":false,"pushed_at":"2025-02-13T03:09:46.000Z","size":127,"stargazers_count":9,"open_issues_count":4,"forks_count":5,"subscribers_count":4,"default_branch":"main","last_synced_at":"2025-02-13T03:25:14.981Z","etag":null,"topics":["library","random","random-number-generators","roc-lang"],"latest_commit_sha":null,"homepage":"https://JanCVanB.github.io/roc-random","language":"HTML","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"upl-1.0","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/JanCVanB.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,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2022-01-07T00:32:06.000Z","updated_at":"2025-02-13T03:02:26.000Z","dependencies_parsed_at":"2024-05-19T20:23:55.489Z","dependency_job_id":"78ed1d11-c10c-4ce2-a669-53da1bdaeb69","html_url":"https://github.com/JanCVanB/roc-random","commit_stats":null,"previous_names":[],"tags_count":4,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/JanCVanB%2Froc-random","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/JanCVanB%2Froc-random/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/JanCVanB%2Froc-random/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/JanCVanB%2Froc-random/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/JanCVanB","download_url":"https://codeload.github.com/JanCVanB/roc-random/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":243475373,"owners_count":20296712,"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","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":["library","random","random-number-generators","roc-lang"],"created_at":"2024-11-19T12:46:16.948Z","updated_at":"2025-03-13T20:12:49.815Z","avatar_url":"https://github.com/JanCVanB.png","language":"HTML","funding_links":[],"categories":[],"sub_categories":[],"readme":"# (Pseudo-)Randomness for Roc\n\nA [Roc](https://github.com/roc-lang/roc) 🦅 library for 🎲 number generation (and more!)\n\nThis library aims to provide the Roc ecosystem with all of the\ngeneral-purpose pure functions that app/package developers need\nto manipulate raw randomness into useful inputs for anything -\nfrom fuzz tests to simulations to video games.\nWith no side effects (like reading from a clock or sensor),\nthis library processes your own noise sample(s) (\"seed(s)\")\ninto your desired shapes, distributions, and sequences.\n\nIf you're an app developer who's unsure how to get a varying seed,\nsee what you can sense using the effects provided by your chosen Roc platform.\n`Time.now!`? `Mouse.coordinates!`? `CPU.temperature!`? `Your.choice!`\n\nContributions \u0026 feedback are very welcome!\n\n### Used By\n\n- 🦅 https://github.com/roc-lang/examples/blob/main/examples/RandomNumbers/main.roc\n- 👾 https://github.com/lukewilliamboswell/roc-ray\n- 🧱 https://github.com/jared-cone/roctris\n- 💞 Add your platform, library, or app here!\n\n## Examples\n\nSee the `examples/*.roc` files for various complete examples, but here is a minimal preview:\n\n### Print a list of 10 random numbers in the range 25-75 inclusive\n\n```roc\n# Create a generator for numbers between 25-75 (inclusive).\ngenerate_a_number = Random.bounded_u32(25, 75)\n\n# Create a generator for lists of 10 numbers.\ngenerate_ten_numbers = generate_a_number |\u003e Random.list(10)\n\n# Initialise \"randomness\". (Bring Your Own source of noise.)\nRandom.seed 1234\n|\u003e Random.step(generate_ten_numbers)\n|\u003e .value\n|\u003e Inspect.to_str\n|\u003e Stdout.line!\n```\n\n## Documentation\n\nSee [the library documentation site](https://jancvanb.github.io/roc-random/0.5.0/Random/)\nfor more info about its API.\n\n## Goals\n\n- An external API that is similar to that of\n  [Elm's `Random` library](https://github.com/elm/random)\n- An internal implementation that is similar to that of\n  [Rust's `Rand` library](https://github.com/rust-random/rand)\n- Compatible with every Roc platform\n  (though some platforms may provide poor/constant [seeding](#seeding))\n- Provides a variety of ergonomic abstractions\n\n## Seeding\n\nIn order to receive a different sequence of outputs from this library between executions of your application, your Roc platform of choice must provide a random/pseudorandom/varying seed.\n\nOtherwise, your pure functions will be responsible for providing `Random`'s pure functions with a constant seed that will merely choose which predictable sequence you'll receive.\n\n## TODO\n\n- Support common non-uniform distributions (Gaussian, etc.)\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fjancvanb%2Froc-random","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fjancvanb%2Froc-random","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fjancvanb%2Froc-random/lists"}