← All packages

random1.3.1

Pseudo-random number generation

Open the imported Cabal file ↗

bug-reports
https://github.com/haskell/random/issues
build-type
Simple
cabal-version
>=1.10
category
System
extra-source-files
README.md CHANGELOG.md
license
BSD3
license-file
LICENSE
maintainer
core-libraries-committee@haskell.org
name
random
synopsis
Pseudo-random number generation
tested-with
GHC == 8.0.2 , GHC == 8.2.2 , GHC == 8.4.4 , GHC == 8.6.5 , GHC == 8.8.4 , GHC == 8.10.7 , GHC == 9.0.2 , GHC == 9.2.8 , GHC == 9.4.8 , GHC == 9.6.6 , GHC == 9.8.4 , GHC == 9.10.1 , GHC == 9.12.1
version
1.3.1
Show the complete metadata as JSON
{
  "schemaVersion": 1,
  "name": "random",
  "version": "1.3.1",
  "cabalVersion": "1.10",
  "buildType": "Simple",
  "fields": {
    "bug-reports": [
      "https://github.com/haskell/random/issues"
    ],
    "build-type": [
      "Simple"
    ],
    "cabal-version": [
      ">=1.10"
    ],
    "category": [
      "System"
    ],
    "description": [
      "This package provides basic pseudo-random number generation, including the\nability to split random number generators.\n.\n== \"System.Random\": pure pseudo-random number interface\n.\nIn pure code, use 'System.Random.uniform' and 'System.Random.uniformR' from\n\"System.Random\" to generate pseudo-random numbers with a pure pseudo-random\nnumber generator like 'System.Random.StdGen'.\n.\nAs an example, here is how you can simulate rolls of a six-sided die using\n'System.Random.uniformR':\n.\n>>> let roll = uniformR (1, 6)        :: RandomGen g => g -> (Word, g)\n>>> let rolls = unfoldr (Just . roll) :: RandomGen g => g -> [Word]\n>>> let pureGen = mkStdGen 42\n>>> take 10 (rolls pureGen)           :: [Word]\n[1,1,3,2,4,5,3,4,6,2]\n.\nSee \"System.Random\" for more details.\n.\n== \"System.Random.Stateful\": monadic pseudo-random number interface\n.\nIn monadic code, use 'System.Random.Stateful.uniformM' and\n'System.Random.Stateful.uniformRM' from \"System.Random.Stateful\" to generate\npseudo-random numbers with a monadic pseudo-random number generator, or\nusing a monadic adapter.\n.\nAs an example, here is how you can simulate rolls of a six-sided die using\n'System.Random.Stateful.uniformRM':\n.\n>>> let rollM = uniformRM (1, 6)                 :: StatefulGen g m => g -> m Word\n>>> let pureGen = mkStdGen 42\n>>> runStateGen_ pureGen (replicateM 10 . rollM) :: [Word]\n[1,1,3,2,4,5,3,4,6,2]\n.\nThe monadic adapter 'System.Random.Stateful.runStateGen_' is used here to lift\nthe pure pseudo-random number generator @pureGen@ into the\n'System.Random.Stateful.StatefulGen' context.\n.\nThe monadic interface can also be used with existing monadic pseudo-random\nnumber generators. In this example, we use the one provided in the\n<https://hackage.haskell.org/package/mwc-random mwc-random> package:\n.\n>>> import System.Random.MWC as MWC\n>>> let rollM = uniformRM (1, 6)       :: StatefulGen g m => g -> m Word\n>>> monadicGen <- MWC.create\n>>> replicateM 10 (rollM monadicGen) :: IO [Word]\n[2,3,6,6,4,4,3,1,5,4]\n.\nSee \"System.Random.Stateful\" for more details."
    ],
    "extra-source-files": [
      "README.md\nCHANGELOG.md"
    ],
    "license": [
      "BSD3"
    ],
    "license-file": [
      "LICENSE"
    ],
    "maintainer": [
      "core-libraries-committee@haskell.org"
    ],
    "name": [
      "random"
    ],
    "synopsis": [
      "Pseudo-random number generation"
    ],
    "tested-with": [
      "GHC == 8.0.2\n, GHC == 8.2.2\n, GHC == 8.4.4\n, GHC == 8.6.5\n, GHC == 8.8.4\n, GHC == 8.10.7\n, GHC == 9.0.2\n, GHC == 9.2.8\n, GHC == 9.4.8\n, GHC == 9.6.6\n, GHC == 9.8.4\n, GHC == 9.10.1\n, GHC == 9.12.1"
    ],
    "version": [
      "1.3.1"
    ]
  },
  "components": [
    {
      "kind": "library",
      "name": "main",
      "tree": {
        "data": {
          "buildable": null,
          "exposedModules": [
            "System.Random",
            "System.Random.Internal",
            "System.Random.Stateful"
          ],
          "otherModules": [
            "System.Random.Array",
            "System.Random.Seed",
            "System.Random.GFinite"
          ],
          "dependencies": [
            {
              "package": "base",
              "range": ">=4.9 && <5",
              "libraries": [
                "main"
              ]
            },
            {
              "package": "bytestring",
              "range": ">=0.10.4 && <0.13",
              "libraries": [
                "main"
              ]
            },
            {
              "package": "deepseq",
              "range": ">=1.1 && <2",
              "libraries": [
                "main"
              ]
            },
            {
              "package": "mtl",
              "range": ">=2.2 && <2.4",
              "libraries": [
                "main"
              ]
            },
            {
              "package": "transformers",
              "range": ">=0.4 && <0.7",
              "libraries": [
                "main"
              ]
            },
            {
              "package": "splitmix",
              "range": ">=0.1 && <0.2",
              "libraries": [
                "main"
              ]
            }
          ],
          "fields": {}
        },
        "branches": [
          {
            "condition": {
              "compiler": "ghc",
              "range": "<9.4"
            },
            "then": {
              "data": {
                "buildable": null,
                "exposedModules": [],
                "otherModules": [],
                "dependencies": [
                  {
                    "package": "data-array-byte",
                    "range": "-any",
                    "libraries": [
                      "main"
                    ]
                  }
                ],
                "fields": {}
              },
              "branches": []
            },
            "else": null
          }
        ]
      }
    },
    {
      "kind": "test-suite",
      "name": "legacy-test",
      "tree": {
        "data": {
          "buildable": null,
          "exposedModules": [],
          "otherModules": [
            "T7936",
            "TestRandomIOs",
            "TestRandomRs",
            "Random1283",
            "RangeTest"
          ],
          "dependencies": [
            {
              "package": "base",
              "range": "-any",
              "libraries": [
                "main"
              ]
            },
            {
              "package": "containers",
              "range": ">=0.5 && <0.8",
              "libraries": [
                "main"
              ]
            },
            {
              "package": "random",
              "range": "-any",
              "libraries": [
                "main"
              ]
            }
          ],
          "fields": {
            "type": [
              "exitcode-stdio-1.0"
            ]
          }
        },
        "branches": []
      }
    },
    {
      "kind": "test-suite",
      "name": "spec",
      "tree": {
        "data": {
          "buildable": null,
          "exposedModules": [],
          "otherModules": [
            "Spec.Range",
            "Spec.Run",
            "Spec.Seed",
            "Spec.Stateful"
          ],
          "dependencies": [
            {
              "package": "base",
              "range": "-any",
              "libraries": [
                "main"
              ]
            },
            {
              "package": "bytestring",
              "range": "-any",
              "libraries": [
                "main"
              ]
            },
            {
              "package": "random",
              "range": "-any",
              "libraries": [
                "main"
              ]
            },
            {
              "package": "smallcheck",
              "range": ">=1.2 && <1.3",
              "libraries": [
                "main"
              ]
            },
            {
              "package": "stm",
              "range": "-any",
              "libraries": [
                "main"
              ]
            },
            {
              "package": "tasty",
              "range": ">=1.0 && <1.6",
              "libraries": [
                "main"
              ]
            },
            {
              "package": "tasty-smallcheck",
              "range": ">=0.8 && <0.9",
              "libraries": [
                "main"
              ]
            },
            {
              "package": "tasty-hunit",
              "range": ">=0.10 && <0.11",
              "libraries": [
                "main"
              ]
            },
            {
              "package": "transformers",
              "range": "-any",
              "libraries": [
                "main"
              ]
            }
          ],
          "fields": {
            "type": [
              "exitcode-stdio-1.0"
            ]
          }
        },
        "branches": []
      }
    },
    {
      "kind": "test-suite",
      "name": "spec-inspection",
      "tree": {
        "data": {
          "buildable": null,
          "exposedModules": [],
          "otherModules": [
            "Spec.Inspection"
          ],
          "dependencies": [
            {
              "package": "base",
              "range": "-any",
              "libraries": [
                "main"
              ]
            },
            {
              "package": "random",
              "range": "-any",
              "libraries": [
                "main"
              ]
            },
            {
              "package": "tasty",
              "range": ">=1.0 && <1.6",
              "libraries": [
                "main"
              ]
            },
            {
              "package": "tasty-inspection-testing",
              "range": "-any",
              "libraries": [
                "main"
              ]
            }
          ],
          "fields": {
            "type": [
              "exitcode-stdio-1.0"
            ]
          }
        },
        "branches": [
          {
            "condition": {
              "compiler": "ghc",
              "range": ">=9.10"
            },
            "then": {
              "data": {
                "buildable": false,
                "exposedModules": [],
                "otherModules": [],
                "dependencies": [],
                "fields": {}
              },
              "branches": []
            },
            "else": null
          }
        ]
      }
    },
    {
      "kind": "benchmark",
      "name": "legacy-bench",
      "tree": {
        "data": {
          "buildable": null,
          "exposedModules": [],
          "otherModules": [
            "BinSearch"
          ],
          "dependencies": [
            {
              "package": "base",
              "range": "-any",
              "libraries": [
                "main"
              ]
            },
            {
              "package": "random",
              "range": "-any",
              "libraries": [
                "main"
              ]
            },
            {
              "package": "rdtsc",
              "range": "-any",
              "libraries": [
                "main"
              ]
            },
            {
              "package": "split",
              "range": ">=0.2 && <0.3",
              "libraries": [
                "main"
              ]
            },
            {
              "package": "time",
              "range": ">=1.4 && <1.13",
              "libraries": [
                "main"
              ]
            }
          ],
          "fields": {
            "type": [
              "exitcode-stdio-1.0"
            ]
          }
        },
        "branches": []
      }
    },
    {
      "kind": "benchmark",
      "name": "bench",
      "tree": {
        "data": {
          "buildable": null,
          "exposedModules": [],
          "otherModules": [],
          "dependencies": [
            {
              "package": "base",
              "range": "-any",
              "libraries": [
                "main"
              ]
            },
            {
              "package": "mtl",
              "range": "-any",
              "libraries": [
                "main"
              ]
            },
            {
              "package": "primitive",
              "range": "-any",
              "libraries": [
                "main"
              ]
            },
            {
              "package": "random",
              "range": "-any",
              "libraries": [
                "main"
              ]
            },
            {
              "package": "splitmix",
              "range": ">=0.1 && <0.2",
              "libraries": [
                "main"
              ]
            },
            {
              "package": "tasty-bench",
              "range": "-any",
              "libraries": [
                "main"
              ]
            }
          ],
          "fields": {
            "type": [
              "exitcode-stdio-1.0"
            ]
          }
        },
        "branches": []
      }
    }
  ],
  "setupDependencies": [],
  "flags": [],
  "sourceRepositories": [
    {
      "kind": "head",
      "fields": {
        "location": [
          "https://github.com/haskell/random.git"
        ],
        "type": [
          "git"
        ]
      }
    }
  ],
  "warnings": [],
  "sourceUrl": "https://hackage.haskell.org/package/random-1.3.1/random.cabal",
  "sha256": "0b4f649c3e78713b2ccad1535251ee34b148237fb2229d7058c2b1d9ccc324b8",
  "importedAt": "2026-10-14T12:47:35.218Z",
  "dependencies": [
    {
      "package": "base",
      "range": ">=4.9 && <5",
      "libraries": [
        "main"
      ],
      "component": "library:main",
      "conditions": []
    },
    {
      "package": "bytestring",
      "range": ">=0.10.4 && <0.13",
      "libraries": [
        "main"
      ],
      "component": "library:main",
      "conditions": []
    },
    {
      "package": "deepseq",
      "range": ">=1.1 && <2",
      "libraries": [
        "main"
      ],
      "component": "library:main",
      "conditions": []
    },
    {
      "package": "mtl",
      "range": ">=2.2 && <2.4",
      "libraries": [
        "main"
      ],
      "component": "library:main",
      "conditions": []
    },
    {
      "package": "transformers",
      "range": ">=0.4 && <0.7",
      "libraries": [
        "main"
      ],
      "component": "library:main",
      "conditions": []
    },
    {
      "package": "splitmix",
      "range": ">=0.1 && <0.2",
      "libraries": [
        "main"
      ],
      "component": "library:main",
      "conditions": []
    },
    {
      "package": "data-array-byte",
      "range": "-any",
      "libraries": [
        "main"
      ],
      "component": "library:main",
      "conditions": [
        {
          "compiler": "ghc",
          "range": "<9.4"
        }
      ]
    },
    {
      "package": "base",
      "range": "-any",
      "libraries": [
        "main"
      ],
      "component": "test-suite:legacy-test",
      "conditions": []
    },
    {
      "package": "containers",
      "range": ">=0.5 && <0.8",
      "libraries": [
        "main"
      ],
      "component": "test-suite:legacy-test",
      "conditions": []
    },
    {
      "package": "random",
      "range": "-any",
      "libraries": [
        "main"
      ],
      "component": "test-suite:legacy-test",
      "conditions": []
    },
    {
      "package": "base",
      "range": "-any",
      "libraries": [
        "main"
      ],
      "component": "test-suite:spec",
      "conditions": []
    },
    {
      "package": "bytestring",
      "range": "-any",
      "libraries": [
        "main"
      ],
      "component": "test-suite:spec",
      "conditions": []
    },
    {
      "package": "random",
      "range": "-any",
      "libraries": [
        "main"
      ],
      "component": "test-suite:spec",
      "conditions": []
    },
    {
      "package": "smallcheck",
      "range": ">=1.2 && <1.3",
      "libraries": [
        "main"
      ],
      "component": "test-suite:spec",
      "conditions": []
    },
    {
      "package": "stm",
      "range": "-any",
      "libraries": [
        "main"
      ],
      "component": "test-suite:spec",
      "conditions": []
    },
    {
      "package": "tasty",
      "range": ">=1.0 && <1.6",
      "libraries": [
        "main"
      ],
      "component": "test-suite:spec",
      "conditions": []
    },
    {
      "package": "tasty-smallcheck",
      "range": ">=0.8 && <0.9",
      "libraries": [
        "main"
      ],
      "component": "test-suite:spec",
      "conditions": []
    },
    {
      "package": "tasty-hunit",
      "range": ">=0.10 && <0.11",
      "libraries": [
        "main"
      ],
      "component": "test-suite:spec",
      "conditions": []
    },
    {
      "package": "transformers",
      "range": "-any",
      "libraries": [
        "main"
      ],
      "component": "test-suite:spec",
      "conditions": []
    },
    {
      "package": "base",
      "range": "-any",
      "libraries": [
        "main"
      ],
      "component": "test-suite:spec-inspection",
      "conditions": []
    },
    {
      "package": "random",
      "range": "-any",
      "libraries": [
        "main"
      ],
      "component": "test-suite:spec-inspection",
      "conditions": []
    },
    {
      "package": "tasty",
      "range": ">=1.0 && <1.6",
      "libraries": [
        "main"
      ],
      "component": "test-suite:spec-inspection",
      "conditions": []
    },
    {
      "package": "tasty-inspection-testing",
      "range": "-any",
      "libraries": [
        "main"
      ],
      "component": "test-suite:spec-inspection",
      "conditions": []
    },
    {
      "package": "base",
      "range": "-any",
      "libraries": [
        "main"
      ],
      "component": "benchmark:legacy-bench",
      "conditions": []
    },
    {
      "package": "random",
      "range": "-any",
      "libraries": [
        "main"
      ],
      "component": "benchmark:legacy-bench",
      "conditions": []
    },
    {
      "package": "rdtsc",
      "range": "-any",
      "libraries": [
        "main"
      ],
      "component": "benchmark:legacy-bench",
      "conditions": []
    },
    {
      "package": "split",
      "range": ">=0.2 && <0.3",
      "libraries": [
        "main"
      ],
      "component": "benchmark:legacy-bench",
      "conditions": []
    },
    {
      "package": "time",
      "range": ">=1.4 && <1.13",
      "libraries": [
        "main"
      ],
      "component": "benchmark:legacy-bench",
      "conditions": []
    },
    {
      "package": "base",
      "range": "-any",
      "libraries": [
        "main"
      ],
      "component": "benchmark:bench",
      "conditions": []
    },
    {
      "package": "mtl",
      "range": "-any",
      "libraries": [
        "main"
      ],
      "component": "benchmark:bench",
      "conditions": []
    },
    {
      "package": "primitive",
      "range": "-any",
      "libraries": [
        "main"
      ],
      "component": "benchmark:bench",
      "conditions": []
    },
    {
      "package": "random",
      "range": "-any",
      "libraries": [
        "main"
      ],
      "component": "benchmark:bench",
      "conditions": []
    },
    {
      "package": "splitmix",
      "range": ">=0.1 && <0.2",
      "libraries": [
        "main"
      ],
      "component": "benchmark:bench",
      "conditions": []
    },
    {
      "package": "tasty-bench",
      "range": "-any",
      "libraries": [
        "main"
      ],
      "component": "benchmark:bench",
      "conditions": []
    }
  ],
  "exposedModules": [
    "System.Random",
    "System.Random.Internal",
    "System.Random.Stateful"
  ],
  "documents": {
    "readme": {
      "status": "available",
      "sha256": "644c57c37f41a6289d8749bd02e79c19addac23c17d4b7043f4bed49d4953c7f",
      "error": null,
      "checkedAt": "2026-10-14T12:47:35.985Z"
    },
    "changelog": {
      "status": "available",
      "sha256": "8c4d910f711fac746619f230f819020004f0065d0cda36c90e273934803f933c",
      "error": null,
      "checkedAt": "2026-10-14T12:47:36.174Z"
    }
  },
  "documentation": null,
  "versions": [
    {
      "version": "1.3.1",
      "imported_at": "2026-10-14T12:47:35.218Z"
    }
  ]
}

Import a package

Enter a package name and an exact version from Hackage. The site contains imported versions only.