Repository: FlaxEngine/FlaxEngine
File: Source/Engine/Utilities/Extensions.cs (C#)

Code before:
                NextFloat(random, 0f, 255f),
                NextFloat(random, 0f, 255f), alpha);
        }

        /// <summary>
        /// Gets a random <see cref="double"/>.
        /// </summary>
        /// <param name="random">An instance of <see cref="Random"/>.</param>
        /// <param name="min">The minimum value.</param>
        /// <param name="max">The maximum value.</param>
        /// <returns>A random <see cref="double"/>.</returns>
        public static double NextDouble(this Random random, double min = 0.0d, double max = 2.0d)
        {
            return random.NextDouble() * (max - min) + min;
        }

        /// <summary>
        /// Gets a random <see cref="long"/>.
        /// </summary>
        /// <param name="random">An instance of <see cref="Random"/>.</param>
        /// <returns>A random <see cref="long"/>.</returns>
        internal static long NextLong(this Random random)
        {
            var numArray = new byte[8];
            random.NextBytes(numArray);
            return (long)(BitConverter.ToUInt64(numArray, 0) & 9223372036854775807L);
        }

        /// <summary>
        /// Generates a random normalized 2D direction <see cref="Vector2"/>.
        /// </summary>
        /// <param name="random">An instance of <see cref="Random"/>.</param>
        /// <returns>A random normalized 2D direction <see cref="Vector2"/>.</returns>
        public static Vector2 NextDirection2D(this Random random)
        {
            return Vector2.Normalize(new Vector2((float)random.NextDouble(), (float)random.NextDouble()));
        }

        /// <summary>
        /// Generates a random normalized 3D direction <see cref="Vector3"/>.
        /// </summary>
        /// <param name="random">An instance of <see cref="Random"/>.</param>
        /// <returns>A random normalized 3D direction <see cref="Vector3"/>.</returns>
        public static Vector3 NextDirection3D(this Random random)
        {
            return Vector3.Normalize(new Vector3((float)random.NextDouble(), (float)random.NextDouble(), (float)random.NextDouble()));
        }

        /// <summary>
        /// Generates a random <see cref="Vector2"/> point in a circle of a given radius.
        /// </summary>

Review comment (suggestion):
For the number you should probably use `long.MaxValue` to make it more clear.

Code after:
        }

        /// <summary>
        /// Gets a random <see cref="Vector3"/> with components in a given range.
        /// </summary>
        /// <param name="random">An instance of <see cref="Random"/>.</param>
        /// <param name="min">The minimum value.</param>
        /// <param name="max">The maximum value.</param>
        /// <returns>A random <see cref="Vector3"/>.</returns>
        public static Vector3 NextVector3(this Random random, float min = 0.0f, float max = 1.0f)
        {
            return new Vector3
            {
                X = NextFloat(random, min, max),
                Y = NextFloat(random, min, max),
                Z = NextFloat(random, min, max)
            };
        }

        /// <summary>
        /// Gets a random <see cref="Vector4"/> with components in a given range.
        /// </summary>
        /// <param name="random">An instance of <see cref="Random"/>.</param>
        /// <param name="min">The minimum value.</param>
        /// <param name="max">The maximum value.</param>
        /// <returns>A random <see cref="Vector4"/>.</returns>
        public static Vector4 NextVector4(this Random random, float min = 0.0f, float max = 1.0f)
        {
            return new Vector4
            {
                X = NextFloat(random, min, max),
                Y = NextFloat(random, min, max),
                Z = NextFloat(random, min, max),
                W = NextFloat(random, min, max)
            };
        }

        /// <summary>
        /// Generates a random <see cref="Color"/>.
        /// </summary>
        /// <param name="random">An instance of <see cref="Random"/>.</param>
        /// <param name="randomAlpha">Randomize the alpha value.</param>
        /// <returns>A nice random <see cref="Color"/>.</returns>
        public static Color NextColor(this Random random, bool randomAlpha = false)
        {
            return new Color
            {
                R = NextFloat(random),
                G = NextFloat(random),
                B = NextFloat(random),
                A = randomAlpha ? NextFloat(random) : 1.0f