{"id":13564594,"url":"https://github.com/mrdimosthenis/minigen","last_synced_at":"2025-04-10T04:10:30.153Z","repository":{"id":53178408,"uuid":"347984530","full_name":"mrdimosthenis/minigen","owner":"mrdimosthenis","description":"Pure random data generation library, appropriate for realistic simulations in the Erlang ecosystem","archived":false,"fork":false,"pushed_at":"2024-09-26T06:14:30.000Z","size":39,"stargazers_count":18,"open_issues_count":0,"forks_count":3,"subscribers_count":2,"default_branch":"master","last_synced_at":"2025-03-24T05:26:09.614Z","etag":null,"topics":["elixir","elixir-lang","erlang","generator","gleam","gleam-lang","random","random-generation"],"latest_commit_sha":null,"homepage":"https://hexdocs.pm/minigen/minigen.html","language":"Gleam","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/mrdimosthenis.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":"2021-03-15T13:40:27.000Z","updated_at":"2024-09-29T09:41:11.000Z","dependencies_parsed_at":"2025-02-16T13:53:08.400Z","dependency_job_id":null,"html_url":"https://github.com/mrdimosthenis/minigen","commit_stats":{"total_commits":20,"total_committers":2,"mean_commits":10.0,"dds":0.09999999999999998,"last_synced_commit":"bcebf1c63115616df3111a0944ce5ddfaff64edc"},"previous_names":[],"tags_count":1,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/mrdimosthenis%2Fminigen","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/mrdimosthenis%2Fminigen/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/mrdimosthenis%2Fminigen/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/mrdimosthenis%2Fminigen/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/mrdimosthenis","download_url":"https://codeload.github.com/mrdimosthenis/minigen/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":247847609,"owners_count":21006099,"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":["elixir","elixir-lang","erlang","generator","gleam","gleam-lang","random","random-generation"],"created_at":"2024-08-01T13:01:33.366Z","updated_at":"2025-04-10T04:10:30.130Z","avatar_url":"https://github.com/mrdimosthenis.png","language":"Gleam","funding_links":[],"categories":["Text and Numbers","Packages"],"sub_categories":["Randomness"],"readme":"# minigen\n\nPure random data generation library, appropriate for realistic simulations in the Erlang ecosystem.\n\n## Installation\n\n* For **Erlang** projects, add the dependency into `rebar.config`:\n\n```erlang\n{deps, [\n    {minigen, \"0.1.1\"}\n]}.\n```\n\n* For **Elixir** projects, add the dependency into `mix.exs`:\n\n```elixir\ndefp deps do\n  [\n    {:minigen, \"~\u003e 0.1.1\", manager: :rebar3}\n  ]\nend\n```\n\n* For **Gleam** projects, run `gleam add minigen`.\n\n## Usage\n\nThe examples below use the `run` function that will probably return different values on each call.\nIf we want to get the same values on each call, we need to use `run_with_seed` instead.\n\nDon't forget to visit https://hexdocs.pm/minigen/minigen.html to see the signature of the available functions:\n`list`, `then`, `always`, `sequence`, `map`, `map2`, `map3`, `map4`, `map5`. Their combination can generate values for any data type.\n\nMore examples can be found in the test directory of the GitHub repository.\n\n### Erlang examples\n\n* Create a random float number\n\n```erlang\nGEN=minigen:float(),\nminigen:run(GEN).\n0.7938520785840248\n```\n\n* Create a random integer number\n\n```erlang\nGEN=minigen:integer(10),\nminigen:run(GEN).\n4\n```\n\n* Create a random boolean value\n\n```erlang\nGEN=minigen:boolean(),\nminigen:run(GEN).\ntrue\n```\n\n* Get a random element from a list\n\n```erlang\nGEN=minigen:element_of_list([1, 2, 3]),\nminigen:run(GEN).\n{ok,2}\n```\n\n```erlang\nGEN=minigen:element_of_list([]),\nminigen:run(GEN).\n{error,nil}\n```\n\n* Shuffle a list\n\n```erlang\nGEN=minigen:shuffled_list([1, 2, 3]),\nminigen:run(GEN).\n[2,1,3]\n```\n\n* Create a random string\n\n```erlang\nGEN=minigen:string(6),\nminigen:run(GEN).\n\"3Rzpqd\"\n```\n\n### Elixir examples\n\n* Create a random float number\n\n```elixir\n:minigen.float\n|\u003e :minigen.run\n0.36087782004967894\n```\n\n* Create a random integer number\n\n```elixir\n:minigen.integer(10)\n|\u003e :minigen.run\n8\n```\n\n* Create a random boolean value\n\n```elixir\n:minigen.boolean\n|\u003e :minigen.run\nfalse\n```\n\n* Get a random element from a list\n\n```elixir\n:minigen.element_of_list([\"a\", \"b\", \"c\", \"d\"])\n|\u003e :minigen.run\n{:ok, \"c\"}\n```\n\n```elixir\n:minigen.element_of_list([])\n|\u003e :minigen.run\n{:error, nil}\n```\n\n* Shuffle a list\n\n```elixir\n:minigen.shuffled_list([\"a\", \"b\", \"c\", \"d\"])\n|\u003e :minigen.run\n[\"c\", \"d\", \"b\", \"a\"]\n```\n\n* Create a random string\n\n```elixir\n:minigen.string(7)\n|\u003e :minigen.run\n\"eJKp8sc\"\n```\n\n### Gleam examples\n\n```gleam\nimport minigen\n```\n\n* Create a random float number\n\n```gleam\nminigen.float()\n|\u003e minigen.run\n0.16296012690374562\n```\n\n* Create a random integer number\n\n```gleam\nminigen.integer(10)\n|\u003e minigen.run\n6\n```\n\n* Create a random boolean value\n\n```gleam\nminigen.boolean()\n|\u003e minigen.run\nTrue\n```\n\n* Get a random element from a list\n\n```gleam\nminigen.element_of_list([0.5348931595479329, 0.47372875562526207, 0.7109364198110805])\n|\u003e minigen.run\nOk(0.7109364198110805)\n```\n\n```gleam\nminigen.element_of_list([])\n|\u003e minigen.run\nError(Nil)\n```\n\n* Shuffle a list\n\n```gleam\nminigen.shuffled_list([0.5348931595479329, 0.47372875562526207, 0.7109364198110805])\n|\u003e minigen.run\n[0.47372875562526207, 0.5348931595479329, 0.7109364198110805]\n```\n\n* Create a random string\n\n```gleam\nminigen.string(8)\n|\u003e minigen.run\n\"U3j641WL\"\n```\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fmrdimosthenis%2Fminigen","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fmrdimosthenis%2Fminigen","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fmrdimosthenis%2Fminigen/lists"}