Documentation
¶
Overview ¶
Package random proives a set of useful functions and methods to generate some random data. It is also known as faker, dump date etc.
Index ¶
- Variables
- func Country() string
- func Digit() int
- func Firstname(gender, country string) string
- func Fullname(gender, country string) string
- func Lastname(country string) string
- func Letter() string
- func LetterLowerCase() string
- func LetterUpperCase() string
- func Lorem() string
- func LoremCharacter(count int) string
- func LoremParagraph(count int) string
- func LoremSentence(count int) string
- func Password(length int) string
- func State() string
- func TC() string
- func UserAgent() string
- type CardType
- type Person
- type QuoteStr
Constants ¶
This section is empty.
Variables ¶
var CountryList = []string{}/* 243 elements not displayed */
CountryList holds the data for country command.
var FirstNameList = []Person{}/* 2408 elements not displayed */
FirstNameList holds the data for names with gender and country.
var LastNameList = []Person{}/* 501 elements not displayed */
LastNameList holds the data for last names with country.
var QuoteList = []QuoteStr{
{
Text: `I'm selfish, impatient and a little insecure. I make mistakes, I am out of control and at times hard to handle. But if you can't handle me at my worst, then you sure as hell don't deserve me at my best.`,
Author: "Marilyn Monroe",
},
{
Text: `Be yourself; everyone else is already taken.`,
Author: "Oscar Wilde",
},
{
Text: `Two things are infinite: the universe and human stupidity; and I'm not sure about the universe.`,
Author: "Albert Einstein",
},
{
Text: `So many books, so little time.`,
Author: "Frank Zappa",
},
{
Text: `Be who you are and say what you feel, because those who mind don't matter, and those who matter don't mind.`,
Author: "Bernard M. Baruch",
},
{
Text: `A room without books is like a body without a soul.`,
Author: "Marcus Tullius Cicero",
},
{
Text: `You've gotta dance like there's nobody watching,
Love like you'll never be hurt,
Sing like there's nobody listening,
And live like it's heaven on earth.`,
Author: "William W. Purkey",
},
{
Text: `You know you're in love when you can't fall asleep because reality is finally better than your dreams.`,
Author: "Dr. Seuss",
},
{
Text: `You only live once, but if you do it right, once is enough.`,
Author: "Mae West",
},
{
Text: `Be the change that you wish to see in the world.`,
Author: "Mahatma Gandhi",
},
{
Text: `In three words I can sum up everything I've learned about life: it goes on.`,
Author: "Robert Frost",
},
{
Text: `If you want to know what a man's like, take a good look at how he treats his inferiors, not his equals.`,
Author: "J.K. Rowling",
},
{
Text: `Don’t walk in front of me… I may not follow
Don’t walk behind me… I may not lead
Walk beside me… just be my friend`,
Author: "Albert Camus",
},
{
Text: `No one can make you feel inferior without your consent.`,
Author: "Eleanor Roosevelt",
},
{
Text: `If you tell the truth, you don't have to remember anything.`,
Author: "Mark Twain",
},
{
Text: `Friendship ... is born at the moment when one man says to another "What! You too? I thought that no one but myself . . .`,
Author: "C.S. Lewis",
},
{
Text: `I've learned that people will forget what you said, people will forget what you did, but people will never forget how you made them feel.`,
Author: "Maya Angelou",
},
{
Text: `A friend is someone who knows all about you and still loves you`,
Author: "Elbert Hubbard",
},
{
Text: `Always forgive your enemies; nothing annoys them so much.`,
Author: "Oscar Wilde",
},
{
Text: `To live is the rarest thing in the world. Most people exist, that is all.`,
Author: "Oscar Wilde",
},
{
Text: `Live as if you were to die tomorrow. Learn as if you were to live forever.`,
Author: "Mahatma Gandhi",
},
{
Text: `Darkness cannot drive out darkness: only light can do that. Hate cannot drive out hate: only love can do that.`,
Author: "Martin Luther King Jr.",
},
{
Text: `I am so clever that sometimes I don't understand a single word of what I am saying.`,
Author: "Oscar Wilde",
},
{
Text: `Without music, life would be a mistake.`,
Author: "Friedrich Nietzsche",
},
{
Text: `We accept the love we think we deserve.`,
Author: "Stephen Chbosky",
},
{
Text: `To be yourself in a world that is constantly trying to make you something else is the greatest accomplishment.`,
Author: "Ralph Waldo Emerson",
},
{
Text: `Here's to the crazy ones. The misfits. The rebels. The troublemakers. The round pegs in the square holes. The ones who see things differently. They're not fond of rules. And they have no respect for the status quo. You can quote them, disagree with them, glorify or vilify them. About the only thing you can't do is ignore them. Because they change things. They push the human race forward. And while some may see them as the crazy ones, we see genius. Because the people who are crazy enough to think they can change the world, are the ones who do.`,
Author: "Rob Siltanen",
},
{
Text: `Insanity is doing the same thing, over and over again, but expecting different results.`,
Author: "Narcotics Anonymous",
},
{
Text: `I believe that everything happens for a reason. People change so that you can learn to let go, things go wrong so that you appreciate them when they're right, you believe lies so you eventually learn to trust no one but yourself, and sometimes good things fall apart so better things can fall together.`,
Author: "Marilyn Monroe",
},
{
Text: `Twenty years from now you will be more disappointed by the things that you didn't do than by the ones you did do. So throw off the bowlines. Sail away from the safe harbor. Catch the trade winds in your sails. Explore. Dream. Discover.`,
Author: "H. Jackson Brown Jr.",
},
{
Text: `So, this is my life. And I want you to know that I am both happy and sad and I'm still trying to figure out how that could be.`,
Author: "Stephen Chbosky",
},
{
Text: `You may say I'm a dreamer, but I'm not the only one. I hope someday you'll join us. And the world will live as one.`,
Author: "John Lennon",
},
{
Text: `And, when you want something, all the universe conspires in helping you to achieve it.`,
Author: "Paulo Coelho",
},
{
Text: `It’s no use going back to yesterday, because I was a different person then.`,
Author: "Lewis Carroll",
},
{
Text: `What you're supposed to do when you don't like a thing is change it. If you can't change it, change the way you think about it. Don't complain.`,
Author: "Maya Angelou",
},
{
Text: `It's the possibility of having a dream come true that makes life interesting.`,
Author: "Paulo Coelho",
},
{
Text: `A person's a person, no matter how small.`,
Author: "Dr. Seuss",
},
{
Text: `He’s not perfect. You aren’t either, and the two of you will never be perfect. But if he can make you laugh at least once, causes you to think twice, and if he admits to being human and making mistakes, hold onto him and give him the most you can. He isn’t going to quote poetry, he’s not thinking about you every moment, but he will give you a part of him that he knows you could break. Don’t hurt him, don’t change him, and don’t expect for more than he can give. Don’t analyze. Smile when he makes you happy, yell when he makes you mad, and miss him when he’s not there. Love hard when there is love to be had. Because perfect guys don’t exist, but there’s always one guy that is perfect for you.`,
Author: "Bob Marley",
},
{
Text: `You can't live your life for other people. You've got to do what's right for you, even if it hurts some people you love.`,
Author: "Nicholas Sparks",
},
{
Text: `Well-behaved women seldom make history.`,
Author: "Laurel Thatcher Ulrich",
},
{
Text: `When I despair, I remember that all through history the way of truth and love have always won. There have been tyrants and murderers, and for a time, they can seem invincible, but in the end, they always fall. Think of it--always.`,
Author: "Mahatma Gandhi",
},
{
Text: `So we beat on, boats against the current, borne back ceaselessly into the past.`,
Author: "F. Scott Fitzgerald",
},
{
Text: `Nothing is impossible, the word itself says 'I'm possible'!`,
Author: "Audrey Hepburn",
},
{
Text: `I can't give you a sure-fire formula for success, but I can give you a formula for failure: try to please everybody all the time.`,
Author: "Herbert Bayard Swope",
},
{
Text: `Do what you feel in your heart to be right – for you’ll be criticized anyway.`,
Author: "Eleanor Roosevelt",
},
{
Text: `Happiness is not something ready made. It comes from your own actions.`,
Author: "Dalai Lama XIV",
},
{
Text: `Never doubt that a small group of thoughtful, committed, citizens can change the world. Indeed, it is the only thing that ever has.`,
Author: "Margaret Mead",
},
{
Text: `Peace begins with a smile..`,
Author: "Mother Teresa",
},
{
Text: `Do not read, as children do, to amuse yourself, or like the ambitious, for the purpose of instruction. No, read in order to live.`,
Author: "Gustave Flaubert",
},
{
Text: `What lies behind us and what lies before us are tiny matters compared to what lies within us.`,
Author: "Ralph Waldo Emerson",
},
{
Text: `Friendship is unnecessary, like philosophy, like art.... It has no survival value; rather it is one of those things which give value to survival.`,
Author: "C.S. Lewis",
},
{
Text: `Whatever you are, be a good one.`,
Author: "Abraham Lincoln",
},
{
Text: `I hope she'll be a fool -- that's the best thing a girl can be in this world, a beautiful little fool.`,
Author: "F. Scott Fitzgerald",
},
{
Text: `Two wrongs don't make a right, but they make a good excuse.`,
Author: "Thomas Szasz",
},
{
Text: `First they ignore you. Then they ridicule you. And then they attack you and want to burn you. And then they build monuments to you.`,
Author: "Nicholas Klein",
},
{
Text: `May you live every day of your life.`,
Author: "Jonathan Swift",
},
}
QuoteList holds the data for quotes with author.
var StateList = []string{
"Alabama",
"Alaska",
"Arizona",
"Arkansas",
"California",
"Colorado",
"Connecticut",
"Delaware",
"Florida",
"Georgia",
"Hawaii",
"Idaho",
"Illinois",
"Indiana",
"Iowa",
"Kansas",
"Kentucky",
"Louisiana",
"Maine",
"Maryland",
"Massachusetts",
"Michigan",
"Minnesota",
"Mississippi",
"Missouri",
"Montana",
"Nebraska",
"Nevada",
"New Hampshire",
"New Jersey",
"New Mexico",
"New York",
"North Carolina",
"North Dakota",
"Ohio",
"Oklahoma",
"Oregon",
"Pennsylvania",
"Rhode Island",
"South Carolina",
"South Dakota",
"Tennessee",
"Texas",
"Utah",
"Vermont",
"Virginia",
"Washington",
"West Virginia",
"Wisconsin",
"Wyoming",
}
StateList hold the data for state command.
var SupportedCards = []CardType{ { Name: "AmericanExpress", Length: []int{15}, Prefix: []string{ "34", "37", }, }, { Name: "DinersClub", Length: []int{14}, Prefix: []string{ "36", "300", "301", "302", "303", "304", "305", }, }, { Name: "DinersClubUS", Length: []int{16}, Prefix: []string{ "54", "55", }, }, { Name: "Discover", Length: []int{16, 19}, Prefix: []string{ "65", "644", "645", "646", "647", "648", "649", "6011", "6222", "6223", "6224", "6225", "6226", "6227", "6228", "62213", "62214", "62215", "62216", "62217", "62218", "62219", "62290", "62291", "622126", "622127", "622128", "622129", "622920", "622921", "622922", "622923", "622924", "622925", }, }, { Name: "JCB", Length: []int{15, 16}, Prefix: []string{ "353", "354", "355", "356", "357", "358", "1800", "2131", "3528", "3529", }, }, { Name: "Laser", Length: []int{16, 17, 18, 19}, Prefix: []string{ "6304", "6706", "6709", "6771", }, }, { Name: "Maestro", Length: []int{12, 13, 14, 15, 16, 17, 18, 19}, Prefix: []string{ "5018", "5020", "5038", "6304", "6759", "6761", "6762", "6763", "6764", "6765", "6766", "6772", }, }, { Name: "Mastercard", Length: []int{16}, Prefix: []string{ "23", "24", "25", "26", "51", "52", "53", "54", "55", "223", "224", "225", "226", "227", "228", "229", "271", "2221", "2222", "2223", "2224", "2225", "2226", "2227", "2228", "2229", "2720", }, }, { Name: "Solo", Length: []int{16, 18, 19}, Prefix: []string{ "6334", "6767", }, }, { Name: "Unionpay", Length: []int{16, 17, 18, 19}, Prefix: []string{ "6222", "6223", "6224", "6225", "6226", "6227", "6228", "62213", "62214", "62215", "62216", "62217", "62218", "62219", "62290", "62291", "622126", "622127", "622128", "622129", "622920", "622921", "622922", "622923", "622924", "622925", }, }, { Name: "Visa", Length: []int{13, 16, 19}, Prefix: []string{ "4", }, }, { Name: "Mir", Length: []int{13, 16}, Prefix: []string{ "2200", "2201", "2202", "2203", "2204", }, }, }
SupportedCards holds all supported card list.
var UserAgentList = []string{
"Mozilla/5.0 (compatible; MSIE 10.0; Windows Phone 8.0; Trident/6.0; IEMobile/10.0; ARM; Touch)",
"Mozilla/5.0 (compatible; MSIE 9.0; Windows NT 6.2; WOW64; Trident/5.0)",
"Mozilla/5.0 (iPhone; CPU iPhone OS 10_3_3 like Mac OS X) AppleWebKit/603.3.8 (KHTML, like Gecko) Version/9.0 Mobile/13B143 Safari/601.1",
"Mozilla/5.0 (Linux; Android 8.0.0; Pixel XL Build/OPR6.170623.012) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/60.0.3112.107 Mobile Safari/537.36",
"Mozilla/5.0 (Linux; Android 8.0.0; Pixel XL Build/OPR6.170623.012) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/60.0.3112.107 Mobile Safari/537.36",
"Mozilla/5.0 (Macintosh; Intel Mac OS X 10_10_1) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/60.0.3112.90 Safari/537.36",
"Mozilla/5.0 (Macintosh; Intel Mac OS X 10_10_5) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/61.0.3163.49 Safari/537.36",
"Mozilla/5.0 (Macintosh; Intel Mac OS X 10_10_5) AppleWebKit/602.1.50 (KHTML, like Gecko) Version/10.0 Safari/602.1.50",
"Mozilla/5.0 (Macintosh; Intel Mac OS X 10_11_6) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/54.0.2840.98 Safari/537.36",
"Mozilla/5.0 (Macintosh; Intel Mac OS X 10_11) AppleWebKit/601.1.56 (KHTML, like Gecko) Version/9.0 Safari/601.1.56",
"Mozilla/5.0 (Macintosh; Intel Mac OS X 10_12_1) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/54.0.2840.98 Safari/537.36",
"Mozilla/5.0 (Macintosh; Intel Mac OS X 10_12_1) AppleWebKit/602.2.14 (KHTML, like Gecko) Version/10.0.1 Safari/602.2.14",
"Mozilla/5.0 (Macintosh; Intel Mac OS X 10.6; rv:25.0) Gecko/20100101 Firefox/25.0",
"Mozilla/5.0 (Macintosh; U; Intel Mac OS X 10_6_2; en-us) AppleWebKit/531.21.8 (KHTML, like Gecko) Version/4.0.4 Safari/531.21.10",
"Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:52.0) Gecko/20100101 Firefox/52.0",
"Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/39.0.2171.71 Safari/537.36 Edge/12.0",
"Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/54.0.2840.99 Safari/537.36",
"Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/55.0.2869.0 Safari/537.36",
"Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/62.0.3191.0 Safari/537.36",
"Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/62.0.3202.94 Safari/537.36",
"Mozilla/5.0 (Windows NT 10.0; WOW64; rv:50.0) Gecko/20100101 Firefox/50.0",
"Mozilla/5.0 (Windows NT 10.0; WOW64; Trident/7.0; Touch; MALNJS; rv:11.0) like Gecko",
"Mozilla/5.0 (Windows NT 10.0; WOW64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/54.0.2840.71 Safari/537.36",
"Mozilla/5.0 (Windows NT 10.0; WOW64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/54.0.2840.99 Safari/537.36",
"Mozilla/5.0 (Windows NT 10.0; WOW64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/60.0.3112.78 Safari/537.36 OPR/47.0.2631.55",
"Mozilla/5.0 (Windows NT 10.0) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/60.0.3112.91 Safari/537.36 Vivaldi/1.92.917.39",
"Mozilla/5.0 (Windows NT 6.1; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/54.0.2840.99 Safari/537.36",
"Mozilla/5.0 (Windows NT 6.1; WOW64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/54.0.2840.71 Safari/537.36",
"Mozilla/5.0 (Windows NT 6.1; WOW64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/54.0.2840.99 Safari/537.36",
"Mozilla/5.0 (Windows NT 6.2; WOW64; rv:39.0) Gecko/20100101 Firefox/39.0",
"Mozilla/5.0 (Windows NT 6.2; WOW64) AppleWebKit/537.36 (KHTML like Gecko) Chrome/28.0.1469.0 Safari/537.36",
"Mozilla/5.0 (Windows NT 6.3; Trident/7.0; rv:11.0) like Gecko",
"Mozilla/5.0 (Windows Phone 10.0; Android 4.2.1; DEVICE INFO) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/39.0.2171.71 Mobile Safari/537.36 Edge/12.0",
"Mozilla/5.0 (X11; Fedora; Linux x86_64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/52.0.2743.116 Safari/537.36",
"Mozilla/5.0 (X11; Linux i686) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/53.0.2785.101 Safari/537.36 OPR/40.0.2308.62",
"Mozilla/5.0 (X11; Linux i686) AppleWebKit/537.36 (KHTML, like Gecko) Ubuntu Chromium/60.0.3112.78 Chrome/60.0.3112.78 Safari/537.36",
"Mozilla/5.0 (X11; Linux x86_64; rv:38.0) Gecko/20100101 Firefox/38.0 Iceweasel/38.2.1",
"Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/33.0.1750.166 Safari/537.36 OPR/20.0.1396.73172",
"Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.4 (KHTML like Gecko) Chrome/22.0.1229.56 Safari/537.4",
"Mozilla/5.0 (X11; Ubuntu; Linux x86_64; rv:55.0) Gecko/20100101 Firefox/55.0",
"Opera/10.61 (J2ME/MIDP; Opera Mini/5.1.21219/19.999; en-US; rv:1.9.3a5) WebKit/534.5 Presto/2.6.30",
}
UserAgentList holds the data for user-agent command.
Functions ¶
func Firstname ¶ added in v0.15.0
Firstname generates a random first name according specified gender and country.
func Fullname ¶ added in v0.15.0
Fullname generates a random full name according specified gender and country.
func Lastname ¶ added in v0.15.0
Lastname generates a random last name according specified gender and country.
func LetterLowerCase ¶
func LetterLowerCase() string
LetterLowerCase generate a random lowercase letter.
func LetterUpperCase ¶
func LetterUpperCase() string
LetterUpperCase generate a random uppercase letter.
func LoremCharacter ¶
LoremCharacter generate dummy character(s) according to the count.
func LoremParagraph ¶
LoremParagraph generate dummy paragraph(s) according to the count.
func LoremSentence ¶
LoremSentence generate dummy sentence(s) according to the count.
Types ¶
type CardType ¶
CardType holds the card type information.
func GetCardType ¶
GetCardType returns card type named or random card type.
func GetRandomCardType ¶
func GetRandomCardType() CardType
GetRandomCardType return a random card type.