This repository has been archived on 2026-09-07. You can view files and clone it. You cannot open issues or pull requests or push a commit.
Files
random/README.md
T

39 lines
804 B
Markdown
Raw Normal View History

2026-09-07 13:08:40 +01:00
> [!IMPORTANT]
> **This repository is archived and no longer maintained.**
>
> The implementation uses `math/rand`, which is not suitable for anything
> security-sensitive, and `Password` has correctness bugs.
>
> **Use instead:**
> - [`crypto/rand`](https://pkg.go.dev/crypto/rand) for tokens, passwords, and anything security-sensitive.
> - [`github.com/matoous/go-nanoid/v2`](https://github.com/matoous/go-nanoid) or [`github.com/google/uuid`](https://github.com/google/uuid) for identifiers.
---
2024-06-21 21:54:44 +01:00
# Go Random
Functions to create random values. That's about the size of it.
## Example
```go
package main
import (
"fmt"
2026-07-04 01:53:00 +01:00
"code.aneur.in/go/random"
2024-06-21 21:54:44 +01:00
)
func main() {
n := make([]bool, 10)
for i := range n {
2026-07-04 01:53:00 +01:00
fmt.Println(random.Alpha(4 + i))
2024-06-21 21:54:44 +01:00
}
}
```
## License
2024-07-19 15:38:37 +01:00
See [LICENSE.md](./LICENSE.md)