common/README.md

65 lines
938 B
Markdown
Raw Normal View History

2022-01-01 21:39:27 +00:00
# common
2022-02-08 12:21:57 +00:00
Welcome to things. Here are some of the aforementioned:
2022-01-01 21:39:27 +00:00
2022-02-08 12:21:57 +00:00
* [hash](./hash)
2022-01-01 21:39:27 +00:00
2022-02-08 12:21:57 +00:00
* [linux](./linux)
2022-01-01 22:01:21 +00:00
2022-02-08 12:21:57 +00:00
* [squish](./squish)
2022-01-01 22:01:21 +00:00
2022-02-08 12:21:57 +00:00
* [entropy](./entropy)
## base
`import "git.tcp.direct/kayos/common"`
2022-01-01 21:39:27 +00:00
2022-02-08 12:21:57 +00:00
### Usage
#### func Abs
2022-01-01 21:39:27 +00:00
```go
2022-02-08 12:21:57 +00:00
func Abs(n int) int
2022-01-01 21:39:27 +00:00
```
2022-02-08 12:21:57 +00:00
Abs will give you the positive version of a negative integer, quickly.
2022-01-01 21:39:27 +00:00
#### func Fprint
```go
func Fprint(w io.Writer, s string)
```
Fprint is fmt.Fprint with error handling.
2022-02-08 12:21:57 +00:00
#### func OneInA
```go
func OneInA(million int) bool
```
2022-01-01 21:39:27 +00:00
#### func RNG
```go
func RNG(n int) int
```
2022-01-01 22:01:21 +00:00
RNG is a Random Number Generator
2022-01-01 21:39:27 +00:00
2022-01-01 22:01:21 +00:00
#### func RandSleepMS
2022-01-01 21:39:27 +00:00
```go
2022-01-01 22:01:21 +00:00
func RandSleepMS(n int)
2022-01-01 21:39:27 +00:00
```
2022-01-01 22:01:21 +00:00
RandSleepMS sleeps for a random period of time with a maximum of n milliseconds.
2022-01-01 21:39:27 +00:00
2022-01-01 22:01:21 +00:00
#### func RandStr
2022-01-01 21:39:27 +00:00
```go
2022-01-01 22:01:21 +00:00
func RandStr(size int) string
2022-01-01 21:39:27 +00:00
```
2022-01-01 22:01:21 +00:00
RandStr generates a random alphanumeric string with a max length of size.
#### func RangeIterate
2022-01-01 21:39:27 +00:00
2022-01-01 22:01:21 +00:00
```go
func RangeIterate(ips interface{}) chan *ipa.IP
```