How To Install ghc-random on Fedora 36

In this tutorial we learn how to install ghc-random in Fedora 36. ghc-random is Pseudo-random number generation

Introduction

In this tutorial we learn how to install ghc-random on Fedora 36.

What is ghc-random

This package provides basic pseudo-random number generation, including the ability to split random number generators. == “System.Random” In pure code, use ‘System.Random.uniform’ and ‘System.Random.uniformR’ from “System.Random” to generate pseudo-random numbers with a pure pseudo-random number generator like ‘System.Random.StdGen’. As an example, here is how you can simulate rolls of a six-sided die using ‘System.Random.uniformR’ »> let roll = uniformR (1, 6) unfoldr (Just . roll) 42 »> take 10 (rolls pureGen) See “System.Random” for more details. == “System.Random.Stateful” In monadic code, use ‘System.Random.Stateful.uniformM’ and ‘System.Random.Stateful.uniformRM’ from “System.Random.Stateful” to generate pseudo-random numbers with a monadic pseudo-random number generator, or using a monadic adapter. As an example, here is how you can simulate rolls of a six-sided die using ‘System.Random.Stateful.uniformRM’ »> let rollM = uniformRM (1, 6) pureGen = mkStdGen 42 »> runStateGen_ pureGen (replicateM 10 . rollM) [Word] [1,1,3,2,4,5,3,4,6,2] The monadic adapter ‘System.Random.Stateful.runGenState_’ is used here to lift the pure pseudo-random number generator ‘pureGen’ into the ‘System.Random.Stateful.StatefulGen’ context. The monadic interface can also be used with existing monadic pseudo-random number generators. In this example, we use the one provided in the » import System.Random.MWC as MWC »> let rollM = uniformRM (1, 6) StatefulGen g m => g -> m Word »> monadicGen <- MWC.create »> replicateM 10 (rollM monadicGen) See “System.Random.Stateful” for more details.

We can use yum or dnf to install ghc-random on Fedora 36. In this tutorial we discuss both methods but you only need to choose one of method to install ghc-random.

Install ghc-random on Fedora 36 Using dnf

Update yum database with dnf using the following command.

sudo dnf makecache --refresh

After updating yum database, We can install ghc-random using dnf by running the following command:

sudo dnf -y install ghc-random

Install ghc-random on Fedora 36 Using yum

Update yum database with yum using the following command.

sudo yum makecache --refresh

After updating yum database, We can install ghc-random using yum by running the following command:

sudo yum -y install ghc-random

How To Uninstall ghc-random on Fedora 36

To uninstall only the ghc-random package we can use the following command:

sudo dnf remove ghc-random

ghc-random Package Contents on Fedora 36

/usr/lib/.build-id
/usr/lib/.build-id/11
/usr/lib/.build-id/11/51562bb814cfdcfa525c856672fe091ba60d63
/usr/lib64/libHSrandom-1.2.0-ALMObmRXrnwLj9oBvdubT1-ghc8.10.5.so
/usr/share/licenses/ghc-random
/usr/share/licenses/ghc-random/LICENSE

References

Summary

In this tutorial we learn how to install ghc-random on Fedora 36 using yum and [dnf]((/fedora/36/dnf/).