https://github.com/seantolstoyevski/crndm
RDRAND Instruction for Golang (created for simpleness and purity)
https://github.com/seantolstoyevski/crndm
assembly go golang random random-number-generator rdrand rdseed x86-64
Last synced: 3 months ago
JSON representation
RDRAND Instruction for Golang (created for simpleness and purity)
- Host: GitHub
- URL: https://github.com/seantolstoyevski/crndm
- Owner: SeanTolstoyevski
- License: mit
- Created: 2022-05-13T20:06:32.000Z (about 3 years ago)
- Default Branch: main
- Last Pushed: 2023-05-26T13:38:10.000Z (about 2 years ago)
- Last Synced: 2025-03-07T13:15:17.938Z (3 months ago)
- Topics: assembly, go, golang, random, random-number-generator, rdrand, rdseed, x86-64
- Language: Go
- Homepage:
- Size: 11.7 KB
- Stars: 3
- Watchers: 1
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# CRNDM - Generate Random Numbers with Hardware
[](https://pkg.go.dev/github.com/SeanTolstoyevski/crndm)
## Benchmark Results:
### Note
`Rdrand` and `Rdseed` instructions are **not designed for speed**. Moreover, the process is even slower because Golang cannot inline assembly codes.
***
```bash
...>go test -bench=.
goos: windows
goarch: amd64
pkg: github.com/SeanTolstoyevski/crndm
cpu: Intel(R) Core(TM) i7-8850H CPU @ 2.60GHz
BenchmarkCrmdnAsUint64-12 10217383 115.6 ns/op
BenchmarkCrmdnAsUint32-12 10326488 116.5 ns/op
BenchmarkCrmdnAsUint16-12 10796784 114.0 ns/op
PASS
ok github.com/SeanTolstoyevski/crndm 4.756s
```## Sources
[Rdrand - Wikipedia](https://en.wikipedia.org/wiki/RDRAND)
[A Quick Guide to Go's Assembler - The Go Programming Language](https://go.dev/doc/asm)