Skip to content
This repository has been archived by the owner on Jun 10, 2022. It is now read-only.

Color3.Random() produces seemingly odd values #592

Open
tleylan opened this issue May 19, 2020 · 0 comments
Open

Color3.Random() produces seemingly odd values #592

tleylan opened this issue May 19, 2020 · 0 comments

Comments

@tleylan
Copy link

tleylan commented May 19, 2020

While a Color3 is generated that variable cannot be turned into a valid hex string using toHexString().

If for instance c1 is defined as Color3.Random() the following is the output of toHexString
c1=#6C.7F4DA7A8C6E84.03A47D1EC7245.4017BE683408

I insured that the colors were specifically between 0 and 255 using the following code and as we can see I get a legitimate hex value c2=#F9EA2D

private RandomColor3(): MRE.Color3 {
return MRE.Color3.FromInts(this.getRandomInt(255), this.getRandomInt(255), this.getRandomInt(255));
}

private getRandomInt(max: number): number {
    return Math.floor(Math.random() * Math.floor(max));
}
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant