summaryrefslogtreecommitdiff
path: root/Plugins/MonoGame.Extended/source/MonoGame.Extended.Particles/FastRandomExtensions.cs
blob: 66c99e7eac28af2799633cbf19fc401fe7fd1d14 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
using MonoGame.Extended;

namespace MonoGame.Extended.Particles
{
    public static class FastRandomExtensions
    {
        public static void NextColor(this FastRandom random, out HslColor color, Range<HslColor> range)
        {
            var maxH = range.Max.H >= range.Min.H
                ? range.Max.H
                : range.Max.H + 360;
            color = new HslColor(random.NextSingle(range.Min.H, maxH),
                random.NextSingle(range.Min.S, range.Max.S),
                random.NextSingle(range.Min.L, range.Max.L));
        }
    }
}