Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Lorem randomization (resolves #1) #52

Closed
wants to merge 3 commits into from

Conversation

thedeeno
Copy link
Contributor

This patch makes it easier to generate random text (and resolves #1). The following Lorem methods (the plurals) can accept a range or array in addition to the standard integer for the count parameter. When a range or array is given, some useful randomization effects can be achieved.

# extended methods
Lorem::characters
Lorem::words
Lorem::sentences
Lorem::paragraphs

# usage - random number from range
Lorem::words(2..5) 
> 2, 3, 4, or 5 words

# usage - random number from set
Lorem::words([1, 4, 6]) 
> 1, 4, or 6 words

Additionally, this patch makes it easier to bootstrap the test env (which I had to do by hand the fist time).

Tests included and passing.

@garethrees
Copy link

+1 for this. Was just about to add an issue similar to #1

@stympy
Copy link
Contributor

stympy commented Sep 15, 2012

Merged. Thanks!

@stympy stympy closed this Sep 15, 2012
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

[Feature] Range argument support for Faker::Lorem.words etc
3 participants