rand-nix

RNG in Nix pure eval mode

  1. 1
  2. 2
  3. 3
  4. 4
  5. 5
  6. 6
  7. 7
  8. 8
  9. 9
  10. 10
  11. 11
  12. 12
  13. 13
  14. 14
  15. 15
  16. 16
  17. 17
  18. 18
  19. 19
  20. 20
  21. 21
  22. 22
  23. 23
  24. 24
  25. 25
  26. 26
  27. 27
  28. 28
  29. 29
  30. 30
  31. 31
# rand-nix

Fork of https://github.com/figsoda/rand-nix/

Test using `echo rng | nix repl --pure-eval .`. Still broken.

## Original README

Eval-time random number generator for Nix without IFD

> **Note** Please don't use this

## Features

- 🔥 Blazingly slow
- 🙏 Perfectly uniform distributions if you believe in it
- 🚀 Impure, unreproducible, and indeterministic
- 🔒 Cryptographically secure, perchance, I think?
- ⚡ Significantly more efficient than all known alternatives
- 💖 Made with love

## Usage

```console
$ nix repl . --extra-experimental-features "flakes repl-flake"
nix-repl> rng.int # random integer from [0, 2^32)
1133288953

nix-repl> map (rng: rng.intBetween 42 1000) (rng.take 8) # 8 random integers from [42, 1000)
[ 861 497 274 908 262 883 374 65 ]
```