Skip to content

Commit

Permalink
Added fluent-style methods for controlling randomness in SyllableSet …
Browse files Browse the repository at this point in the history
…and TransformSet
  • Loading branch information
kesac committed Jun 6, 2024
1 parent 5e80538 commit b3afb10
Show file tree
Hide file tree
Showing 2 changed files with 21 additions and 0 deletions.
11 changes: 11 additions & 0 deletions Syllabore/Syllabore/SyllableSet.cs
Original file line number Diff line number Diff line change
Expand Up @@ -108,6 +108,17 @@ public SyllableSet WithGenerator(ISyllableGenerator provider)
return this;
}


/// <summary>
/// Sets the instance of <see cref="System.Random"/>
/// used to simulate randomness during syllable generation.
/// </summary>
public SyllableSet WithRandom(Random random)
{
this.Random = random;
return this;
}

/// <summary>
/// Adds a syllable to this <see cref="SyllableSet"/>'s pool of starting syllables.
/// </summary>
Expand Down
10 changes: 10 additions & 0 deletions Syllabore/Syllabore/TransformSet.cs
Original file line number Diff line number Diff line change
Expand Up @@ -167,6 +167,16 @@ public TransformSet WithTransform(Func<Transform, Transform> config)
return this;
}

/// <summary>
/// Sets the instance of <see cref="System.Random"/>
/// used to simulate randomness when <see cref="UseRandomSelection"/> is true.
/// </summary>
public TransformSet WithRandom(Random random)
{
this.Random = random;
return this;
}

/// <summary>
/// <para>
/// Applies a weight to the last added transform that influences the probability of being used over others.
Expand Down

0 comments on commit b3afb10

Please sign in to comment.