{"id":20875990,"url":"https://github.com/juliarandom/randommonad.jl","last_synced_at":"2026-03-10T17:37:42.086Z","repository":{"id":83754814,"uuid":"249483074","full_name":"JuliaRandom/RandomMonad.jl","owner":"JuliaRandom","description":"A Julia package for defining and combining distributions","archived":false,"fork":false,"pushed_at":"2021-11-29T12:03:05.000Z","size":165,"stargazers_count":3,"open_issues_count":0,"forks_count":0,"subscribers_count":1,"default_branch":"master","last_synced_at":"2025-03-12T16:18:01.331Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":"","language":"Julia","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"other","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/JuliaRandom.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE.md","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":"2020-03-23T16:23:18.000Z","updated_at":"2024-07-21T05:04:32.000Z","dependencies_parsed_at":null,"dependency_job_id":"ea299925-f64e-470c-8c94-bd283161373d","html_url":"https://github.com/JuliaRandom/RandomMonad.jl","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"purl":"pkg:github/JuliaRandom/RandomMonad.jl","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/JuliaRandom%2FRandomMonad.jl","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/JuliaRandom%2FRandomMonad.jl/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/JuliaRandom%2FRandomMonad.jl/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/JuliaRandom%2FRandomMonad.jl/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/JuliaRandom","download_url":"https://codeload.github.com/JuliaRandom/RandomMonad.jl/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/JuliaRandom%2FRandomMonad.jl/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":30344763,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-03-10T15:55:29.454Z","status":"ssl_error","status_checked_at":"2026-03-10T15:54:58.440Z","response_time":106,"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":[],"created_at":"2024-11-18T06:49:25.745Z","updated_at":"2026-03-10T17:37:42.052Z","avatar_url":"https://github.com/JuliaRandom.png","language":"Julia","funding_links":[],"categories":[],"sub_categories":[],"readme":"# RandomMonad\n\n[![Build Status](https://travis-ci.org/rfourquet/RandomMonad.jl.svg?branch=master)](https://travis-ci.org/rfourquet/RandomMonad.jl)\n\nRandomMonad provides a number of composable primitives for constructing\n\"distributions\". A distribution is understood in a broad sense: it is anything\non which `rand` can be called. A distribution is like a recipe describing how\nto construct an object of a certain type. For example, `1:3` is an implicit\ndistribution describing how to pick randomly an `Int` among `1`, `2`, `3`.\n\nUnlike [Distributions.jl](https://github.com/JuliaStats/Distributions.jl)\nwhich seriously addresses mathematical needs, the `RandomMonad` package is\nless specific and is intended to be generally useful for implementing\nrandomness. This is reflected in the core type, a simple `Distribution{T}`,\nwhere `T` can be anything and is just the type of generated values.\n\nCurrently, `RandomMonad` also implements few classical mathematical\ndistributions, like `Bernoulli` or `Poisson`, but these might eventually be\nsplit off in another dedicated package.\n\n## Examples\n\nA basic distribution is `Fill(d, n)`, defining the generation of arrays of\nlength `n` of elements drawn from distribution `d`:\n\n```julia-repl\njulia\u003e f = Fill(1:9, 4)\nFill(1:9, 4)\n\njulia\u003e eltype(f)\nArray{Int64,1}\n\njulia\u003e rand(f)\n4-element Array{Int64,1}:\n 8\n 3\n 8\n 4\n```\n\nMany algorithms which use randomness can be encapsulated as a distribution.\nFor example, `Shuffle` defines an alternate API to the `Random.shuffle` function,\nbut is more general. The following example creates an array of two vectors of\nlength `4` of distinct elements from `1:5`:\n\n```julia-repl\njulia\u003e rand(Fill(Shuffle(1:5), 4), 2)\n2-element Array{Array{Int64,1},1}:\n [3, 4, 5, 1]\n [4, 1, 3, 5]\n```\nThis is sampling from a collection \"without replacement\", and is\nequivalent to `[StatsBase.sample(1:5, 4, replace=false) for _=1:2]`.\n\n## But... what is a Monad??\n\nI won't add yet another tutorial on monads, but the good news is that knowing\nthe theory of monads is not at all necessary for using this package. It just\nso happens that `Distributions{T}` has a monadic structure, and the package\nprovides some related \"combinators\" (basic blocs to create more elaborate\nconstructions).\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fjuliarandom%2Frandommonad.jl","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fjuliarandom%2Frandommonad.jl","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fjuliarandom%2Frandommonad.jl/lists"}