Documentation ¶
Overview ¶
Package randomdata implements a bunch of simple ways to generate (pseudo) random data
Index ¶
- Constants
- func Address() string
- func Adjective() string
- func Alphanumeric(length int) string
- func Boolean() bool
- func BoundedDigits(digits, low, high int) string
- func City() string
- func Country(countryStyle int64) string
- func Currency() string
- func CustomRand(randToUse *rand.Rand)
- func Day() string
- func Decimal(numberRange ...int) float64
- func Digits(digits int) string
- func Email() string
- func FirstName(gender int) string
- func FullDate() string
- func FullDateInRange(dateRange ...string) string
- func FullName(gender int) string
- func IpV4Address() string
- func IpV6Address() string
- func LastName() string
- func Letters(letters int) string
- func Locale() string
- func MacAddress() string
- func Month() string
- func Noun() string
- func Number(numberRange ...int) int
- func Paragraph() string
- func PhoneNumber() string
- func PostalCode(countrycode string) string
- func ProvinceForCountry(countrycode string) string
- func RandStringRunes(n int) string
- func SillyName() string
- func State(typeOfState int) string
- func Street() string
- func StreetForCountry(countrycode string) string
- func StringNumber(numberPairs int, separator string) string
- func StringNumberExt(numberPairs int, separator string, numberOfDigits int) string
- func StringSample(stringList ...string) string
- func Timezone() string
- func Title(gender int) string
- func UserAgentString() string
- type Profile
Constants ¶
const ( Male int = 0 Female int = 1 RandomGender int = 2 )
const ( Small int = 0 Large int = 1 )
const ( FullCountry = 0 TwoCharCountry = 1 ThreeCharCountry = 2 )
const ( DateInputLayout = "2006-01-02" DateOutputLayout = "2006-01-02" )
const ALPHANUMERIC = "abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789"
Variables ¶
This section is empty.
Functions ¶
func Alphanumeric ¶
Alphanumeric returns a random alphanumeric string consits of [0-9a-zA-Z].
func BoundedDigits ¶
BoundedDigits generates a string of N random digits, padded with zeros if necessary. The output is restricted to the given range.
func Country ¶
Country returns a random country, countryStyle decides what kind of format the returned country will have
func CustomRand ¶
func FullDateInRange ¶
FullDateInRange returns a date string within a given range, given in the format "2006-01-02". If no argument is supplied it will return the result of randomdata.FullDate(). If only one argument is supplied it is treated as the max date to return. If a second argument is supplied it returns a date between (and including) the two dates. Returned date is in format "Monday 2 Jan 2006".
func FullName ¶
FullName returns a combination of FirstName LastName randomized, gender decides the gender of the name
func Number ¶
Number returns a random number, if only one integer (n1) is supplied it returns a number in [0,n1) if a second argument is supplied it returns a number in [n1,n2)
func PhoneNumber ¶
func PhoneNumber() string
func PostalCode ¶
PostalCode yields a random postal/zip code for the given 2-letter country code.
These codes are not guaranteed to refer to actually locations. They merely follow the correct format as far as letters and digits goes. Where possible, the function enforces valid ranges of letters and digits.
func ProvinceForCountry ¶
ProvinceForCountry returns a randomly selected province (state, county,subdivision ) name for a supplied country. If the country is not supported it will return an empty string.
func RandStringRunes ¶
func SillyName ¶
func SillyName() string
SillyName returns a silly name, useful for randomizing naming of things
func StreetForCountry ¶
StreetForCountry returns a random fake street name typical to the supplied country. If the country is not supported it will return an empty string.
func StringNumber ¶
StringNumber returns a random number as a string
func StringNumberExt ¶
func StringSample ¶
StringSample returns a random string from a list of strings
func UserAgentString ¶
func UserAgentString() string
Types ¶
type Profile ¶
type Profile struct { Gender string `json:"gender"` Name struct { First string `json:"first"` Last string `json:"last"` Title string `json:"title"` } `json:"name"` Location struct { Street string `json:"street"` City string `json:"city"` State string `json:"state"` Postcode int `json:"postcode"` } `json:"location"` Email string `json:"email"` Login struct { Username string `json:"username"` Password string `json:"password"` Salt string `json:"salt"` Md5 string `json:"md5"` Sha1 string `json:"sha1"` Sha256 string `json:"sha256"` } `json:"login"` Dob string `json:"dob"` Registered string `json:"registered"` Phone string `json:"phone"` Cell string `json:"cell"` ID struct { Name string `json:"name"` Value interface{} `json:"value"` } `json:"id"` Picture struct { Large string `json:"large"` Medium string `json:"medium"` Thumbnail string `json:"thumbnail"` } `json:"picture"` Nat string `json:"nat"` }