Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 9 additions & 0 deletions ColorHelper/Generator/ColorGenerator.cs
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,16 @@ private static T GetRandomColor<T>(RgbRandomColorFilter filter) where T : IColor

return ConvertRgbToNecessaryColorType<T>(rgb);
}
private static T GetRandomColor<T>(RgbRandomColorFilter filter,int seed) where T : IColor
{
Random random = new Random(seed);

RGB rgb = new RGB(
(byte)random.Next(filter.minR, filter.maxR),
(byte)random.Next(filter.minG, filter.maxG),
(byte)random.Next(filter.minB, filter.maxB));
return ConvertRgbToNecessaryColorType<T>(rgb);
}
private static T ConvertRgbToNecessaryColorType<T>(RGB rgb) where T: IColor
{
if (typeof(T) == typeof(RGB))
Expand Down