go-arbitrary/default.go

81 lines
1.6 KiB
Go
Raw Normal View History

2021-11-21 01:05:20 +00:00
package arbitrary
import (
"math/rand"
2022-12-14 14:16:55 +00:00
"io/fs"
2022-12-14 14:12:31 +00:00
"net"
2021-11-21 01:05:20 +00:00
"time"
)
var (
Default = New( rand.NewSource( time.Now().UTC().UnixNano() ) )
)
2021-11-21 01:46:15 +00:00
// Bool returns an arbitrary bool.
2021-11-21 01:05:20 +00:00
func Bool() bool {
return Default.Bool()
}
2022-12-14 14:23:15 +00:00
// HTMLFile returns an arbitrary fs.File regular-file whose content is an HTML file.
func HTMLFile() fs.File {
return Default.HTMLFile()
}
2022-12-14 14:12:31 +00:00
// NetAddr returns an arbitrary net.Addr.
func NetAddr() net.Addr {
return Default.NetAddr()
}
2022-12-14 14:36:14 +00:00
// NetPort returns an arbitrary network port.
func NetPort() uint16 {
return Default.NetPort()
}
2021-11-22 19:50:54 +00:00
// Password returns an arbitrary password.
func Password() string {
return Default.Password()
}
2024-08-26 22:15:24 +00:00
// PctEncoded returns an arbitrary pct-encoded.
2024-08-25 12:47:26 +00:00
func PctEncoded() string {
return Default.PctEncoded()
}
2021-11-21 01:46:15 +00:00
// PhoneNumber returns an arbitrary phonenumber.
2021-11-22 18:07:00 +00:00
//
// Some example phonenumber include:
//
// 289-5625421
// (604) 585-1234
// ٠٩٦-٣٦١-٦٦٧٦
// 613/978-1920
// +20-13-004-6453
// (782) 440 6832
// +٢٠-٩٣-٧٤٨-٧٩٨١
// 093-340-0709
// +1-403-870-6449
// +18250827424
//
// (Note that there are other phonenumber formats too, in addition to the formats that are implied by the examples provided here.)
2021-11-21 01:46:15 +00:00
func PhoneNumber() string {
return Default.PhoneNumber()
}
2022-12-14 14:16:55 +00:00
// RegularFile returns an arbitrary fs.File regular-file.
func RegularFile() fs.File {
return Default.RegularFile()
}
2021-11-21 01:05:20 +00:00
func Runes(a ...interface{}) []rune {
return Default.Runes(a...)
}
func String(a ...interface{}) string {
return Default.String(a...)
}
2022-12-14 14:20:25 +00:00
// TextFile returns an arbitrary fs.File regular-file whose content is a text-file.
func TextFile() fs.File {
return Default.TextFile()
}