mirror of
https://github.com/tonytins/Lorem.NET.git
synced 2025-07-10 00:30:27 -04:00
all
This commit is contained in:
parent
4d5f21b34a
commit
12a803ac54
17 changed files with 83 additions and 18 deletions
55
readme.html
Normal file
55
readme.html
Normal file
|
@ -0,0 +1,55 @@
|
|||
<h1>Lorem.NET</h1>
|
||||
|
||||
<p>A .NET library for all things random!</p>
|
||||
|
||||
<h2>Usage</h2>
|
||||
|
||||
<h3>Text Helpers</h3>
|
||||
|
||||
<p>```csharp
|
||||
// this will generate a string with three words:
|
||||
string words = LoremNET.Lorem.Words(3);</p>
|
||||
|
||||
<p>// this will generate a string with two to five words:
|
||||
string words = LoremNET.Lorem.Words(2, 5);</p>
|
||||
|
||||
<p>// this will generate a string with five to ten words with "uppercaseFirstLetter" set to "false" and "includePunctuation" set to "true":
|
||||
string words = LoremNET.Lorem.Words(5, 10, false, true);</p>
|
||||
|
||||
<p>// a sentence is the same as "Words" except that it will include punctuation by default and will include a "." at the end of a string:
|
||||
string sentence = LoremNET.Lorem.Sentence(5, 10);</p>
|
||||
|
||||
<p>// a paragraph is a string composed of multiple sentences; this paragraph will have five to six words per sentence, and four to ten sentences:
|
||||
string paragraph = LoremNET.Lorem.Paragraph(5, 6, 4, 10);</p>
|
||||
|
||||
<p>// paragraphs is an array of paragraphs; this method will have eight to nine words per sentence, four to five sentences per paragraph, and one to three paragraphs:
|
||||
string[] paragraphs = LoremNET.Lorem.Paragraphs(8, 9, 4, 5, 1, 3);
|
||||
```</p>
|
||||
|
||||
<h3>Extras</h3>
|
||||
|
||||
<p>```csharp
|
||||
// this will generate a random valid email address:
|
||||
string email = LoremNET.Lorem.Email();</p>
|
||||
|
||||
<p>// this will generate a random DateTime object between 1/1/1950 and the current DateTime:
|
||||
DateTime dateTime = LoremNET.Lorem.DateTime();</p>
|
||||
|
||||
<p>// this will generate a random DateTime object between 1/1/1995 and 12/31/2020:
|
||||
DateTime dateTime = LoremNET.Lorem.DateTime(new DateTime(1995, 1, 1), new DateTime(2020, 12, 31))</p>
|
||||
|
||||
<p>// this will return "true" 55% of the time:
|
||||
bool isTruth = LoremNET.Lorem.Chance(55, 100);</p>
|
||||
|
||||
<p>// this will randomly select an item from the group:
|
||||
string[] numbers = GetNumbers();
|
||||
string number = LoremNET.Lorem.Random(numbers);
|
||||
```</p>
|
||||
|
||||
<h3>RandomHelper</h3>
|
||||
|
||||
<p>Lorem.NET includes a thread-safe System.Random instance.</p>
|
||||
|
||||
<p><code>csharp
|
||||
int i = LoremNET.RandomHelper.Instance.Next(1, 2)
|
||||
</code></p>
|
Loading…
Add table
Add a link
Reference in a new issue