Skip to content

Commit

Permalink
Merge pull request #251 from n3xem/update-doc-generate-string-length-n
Browse files Browse the repository at this point in the history
Docs: add note of function that generate strings with a length of N
  • Loading branch information
brianvoe committed Aug 2, 2023
2 parents 785747c + 97da5e4 commit 13b7ee2
Showing 1 changed file with 4 additions and 4 deletions.
8 changes: 4 additions & 4 deletions string.go
Original file line number Diff line number Diff line change
Expand Up @@ -10,10 +10,10 @@ func (f *Faker) Letter() string { return letter(f.Rand) }

func letter(r *rand.Rand) string { return string(randLetter(r)) }

// LetterN will generate a random ASCII string with length N
// LetterN will generate a random ASCII string with length N. Note that this function returns a string with a length of 1 when 0 is passed.
func LetterN(n uint) string { return letterN(globalFaker.Rand, n) }

// LetterN will generate a random ASCII string with length N
// LetterN will generate a random ASCII string with length N. Note that this function returns a string with a length of 1 when 0 is passed.
func (f *Faker) LetterN(n uint) string { return letterN(f.Rand, n) }

func letterN(r *rand.Rand, n uint) string {
Expand Down Expand Up @@ -44,10 +44,10 @@ func (f *Faker) Digit() string { return digit(f.Rand) }

func digit(r *rand.Rand) string { return string(randDigit(r)) }

// DigitN will generate a random string of length N consists of ASCII digits (note it can start with 0).
// DigitN will generate a random string of length N consists of ASCII digits. Note that the string generated can start with 0 and this function returns a string with a length of 1 when 0 is passed.
func DigitN(n uint) string { return digitN(globalFaker.Rand, n) }

// DigitN will generate a random string of length N consists of ASCII digits (note it can start with 0).
// DigitN will generate a random string of length N consists of ASCII digits. Note that the string generated can start with 0 and this function returns a string with a length of 1 when 0 is passed.
func (f *Faker) DigitN(n uint) string { return digitN(f.Rand, n) }

func digitN(r *rand.Rand, n uint) string {
Expand Down

0 comments on commit 13b7ee2

Please sign in to comment.