Files
AssetRipper.TextureDecoder/AssetRipper.TextureDecoder.Tests/Formats/ColorRandom.cs
T
Jeremy Pritts aea54da07a Generic Color Structs
* Resolves #42
* Removes many of the nongeneric structs
* Unit tests for ColorRGB32Half are disabled (#17)
2023-08-02 03:52:34 -04:00

19 lines
595 B
C#

using AssetRipper.TextureDecoder.Rgb;
namespace AssetRipper.TextureDecoder.Tests.Formats;
internal static class ColorRandom<TColor, TChannel> where TColor : unmanaged, IColor<TChannel> where TChannel : unmanaged
{
public static TChannel MakeRandomValue()
{
ulong value = TestContext.CurrentContext.Random.NextULong();
return NumericConversion.Convert<ulong, TChannel>(value);
}
public static TColor MakeRandomColor()
{
TColor color = default;
color.SetChannels(MakeRandomValue(), MakeRandomValue(), MakeRandomValue(), MakeRandomValue());
return color;
}
}