{
  "canonical_url": "https://crates.flyology.org/community/",
  "catalog": {
    "name": "community",
    "repository_url": "https://github.com/alire-project/alire-index",
    "revision": "cd12c6aa35b7d6483841517305d57ba167ec78d0"
  },
  "generated_at": "2026-08-23T04:55:42Z",
  "index": {
    "version": "1.4.0"
  },
  "package": {
    "catalog": "community",
    "description": "Random number generation toolkit",
    "development_only": false,
    "latest_version": "0.1.0",
    "name": "rand",
    "selected_version": "0.1.0",
    "versions": [
      {
        "dependants": [],
        "dependencies": [
          {
            "catalog": "community",
            "condition": null,
            "name": "rand_chacha",
            "package": "rand_chacha",
            "provided_version": "0.1.0",
            "requirement": "~0.1.0",
            "resolved": true,
            "version": "0.1.0"
          },
          {
            "catalog": "community",
            "condition": null,
            "name": "rand_core",
            "package": "rand_core",
            "provided_version": "0.1.0",
            "requirement": "~0.1.0",
            "resolved": true,
            "version": "0.1.0"
          },
          {
            "catalog": "community",
            "condition": null,
            "name": "rand_distributions",
            "package": "rand_distributions",
            "provided_version": "0.1.0",
            "requirement": "~0.1.0",
            "resolved": true,
            "version": "0.1.0"
          },
          {
            "catalog": "community",
            "condition": null,
            "name": "rand_xoshiro256",
            "package": "rand_xoshiro256",
            "provided_version": "0.1.0",
            "requirement": "~0.1.0",
            "resolved": true,
            "version": "0.1.0"
          },
          {
            "catalog": "community",
            "condition": null,
            "name": "rand_sys",
            "package": "rand_sys",
            "provided_version": "0.1.0",
            "requirement": "~0.1.0",
            "resolved": true,
            "version": "0.1.0"
          }
        ],
        "development": false,
        "external": false,
        "manifest": {
          "authors": [
            "César SAGAERT"
          ],
          "build-switches": {
            "*": {
              "ada_version": "Ada2022"
            }
          },
          "depends-on": [
            {
              "rand_chacha": "~0.1.0",
              "rand_core": "~0.1.0",
              "rand_distributions": "~0.1.0",
              "rand_sys": "~0.1.0",
              "rand_xoshiro256": "~0.1.0"
            }
          ],
          "description": "Random number generation toolkit",
          "licenses": "Apache-2.0 WITH LLVM-exception",
          "long-description": "# Random number generation toolkit for Ada\n\nDesign principles mostly inspired by the [rand](https://github.com/rust-random/rand) Rust crate.\n\nThe project is split into several subcrates. `rand_core`, `rand_chacha`, `rand_xoshiro256` and `rand_distributions` can be used on embedded; However, `rand_sys` (and its dependent `rand`, the main crate) pull entropy from system sources, using the [`system_random`](https://alire.ada.dev/crates/system_random) Alire crate.\n\n## Usage examples\n\nGet a thread local instance of a secure Random Number Generator (RNG), seeded with system entropy:\n\n```ada\nwith Rand;\nR : Rand.Rng := Rand.Thread_Rng;\n--  alternatively:\nR : Rand.Rng := Rand.Small_Rng;\n   --  a fast, unsecure RNG seeded with system entropy\nR : Rand.Rng := Rand.Sys.Get;\n   --  RNG based on system randomness sources\n   --  (OS-dependent)\n```\n\nUse convenience methods on the RNG to generate basic types:\n\n```ada\nV1 : Float := R.Gen;        --  a float in the range [0, 1)\nV2 : Long_Integer := R.Gen; --  a long integer over the whole range\n```\n\nYou can also define your own random number generators by implementing the `Rand.Core_Rng` interface (alias for `Rand_Core.Rng`).\n\nUse `Next` and `Next_Bytes` to get the raw output of any RNG:\n\n```ada\nBuf : Rand.Core.Bytes (1 .. 256);\nR.Next_Bytes (Buf);\nX : Rand.Core.U64 := R.Next;\n```\n\nUse a predefined random distribution to get finer random value selection:\n\n```ada\nuse Rand.Distributions;\nD1 : Uniform_Nat.Distribution := Uniform_Nat.Create (8, 27);\nS : Natural := D1.Sample (R);\n   --  sample in the inclusive range [8, 27]\n\nD2 : Bernoulli := Bernoulli.Create (0.25);\nS : Boolean := D2.Sample (R);\n   --  a boolean that is True 25% of the time\n```\n\nOr define your own distributions:\n\n```ada\nuse Rand.Distributions;\n\ntype Gaussian is new Long_Float_Distr.Distribution with record\n   Sigma : Long_Float;\nend record;\n\noverriding\nfunction Sample (D : Gaussian; R : in out Rand.Rng) return Long_Float\nis (...); --  sampling the custom distribution\n```\n\nEven on your own types:\n\n```ada\nwith Rand_Distributions; use Rand_Distributions;\n\ntype My_Rec is record\n   A : Integer;\n   B : Float;\nend record;\n\npackage I is new Generic_Distribution (My_Rec);\n--  define the interface distributions over your type must implement\n\ntype My_Distr is new I.Distribution with null record;\n\noverriding\nfunction Sample (D : My_Distr; R : in out Rand.Rng) return My_Rec\nis (A => 4, --  chosen by fair dice roll\n    B => R.Gen);\n```\n",
          "maintainers": [
            "César SAGAERT <sagaert@adacore.com>"
          ],
          "maintainers-logins": [
            "AldanTanneo"
          ],
          "name": "rand",
          "origin": {
            "commit": "6d1af921227f1e7e0d61bf3cee431af701b99508",
            "url": "git+https://github.com/AldanTanneo/rand-ada.git"
          },
          "tags": [
            "random",
            "chacha20",
            "rng",
            "getrandom",
            "security"
          ],
          "version": "0.1.0",
          "website": "https://github.com/AldanTanneo/rand-ada"
        },
        "path": "index/ra/rand/rand-0.1.0.toml",
        "version": "0.1.0"
      }
    ]
  },
  "schema_version": 4
}
