private void Start()
        {
            randomEssentials = new UnityEngine.RandomEssentials();

            //EXAMPLES:
            bool    randomBool            = randomEssentials.GetRandomBool(0.75f);
            int     randomInt             = randomEssentials.GetRandomInt(3, 10);
            float   randomFloat           = randomEssentials.GetRandomFloat(0.5f, 0.1f);
            Vector3 randomVector3         = randomEssentials.GetRandomVector3(0.5f, 0.1f);
            Vector2 randomVector2         = randomEssentials.GetRandomVector2(0.5f, 0.1f);
            int     randomSign            = randomEssentials.GetRandomSign(0.4f);
            bool    randomBoolTrueEnsured = randomEssentials.GetRandomBoolTrueEnsured(3, 10);
            bool    randomDistributedBool = randomEssentials.GetPseudoRandomDistributedBool(5, 0.25f);
            // This variables are not used anywhere, they exist only to help the example.
        }
Exemplo n.º 2
0
        private void Start()
        {
            randomEssentials = new UnityEngine.RandomEssentials();

            //EXAMPLES:
            bool    randomBool            = randomEssentials.GetRandomBool(0.75f);
            int     randomInt             = randomEssentials.GetRandomInt(3, 10);
            float   randomFloat           = randomEssentials.GetRandomFloat(0.5f, 0.1f);
            Vector3 randomVector3         = randomEssentials.GetRandomVector3(0.5f, 0.1f);
            Vector2 randomVector2         = randomEssentials.GetRandomVector2(0.5f, 0.1f);
            int     randomSign            = randomEssentials.GetRandomSign(0.4f);
            bool    randomBoolTrueEnsured = randomEssentials.GetRandomBoolTrueEnsured(3, 10);
            bool    randomDistributedBool = randomEssentials.GetPseudoRandomDistributedBool(5, 0.25f);

            // To make easier the single use of RandomEssentials, the object can be created and used as follows:
            randomBool = UnityEngine.RandomEssentials.GetNew().GetRandomBool();
            randomBool = UnityEngine.RandomEssentials.GetNew(123456).GetRandomBool(); // With custom seed

            // This variables are not used anywhere, they exist only to help the example.
        }