void Start() { DebugPro.Log(" ======== DEBUGGING ARRAY: ======== "); int[] arrayInts = { 1, 2, 3, 4, 5, 6, 7, 8 }; DebugPro.LogEnumerable(arrayInts); // Array with no message and default separator DebugPro.LogEnumerable(arrayInts, " | "); // Array with no message DebugPro.LogEnumerable(arrayInts, " - ", "Message printed before the list array: "); // Array with message DebugPro.LogEnumerable(arrayInts, " / ", "Message printed before the list array: ", this); // Array with message and referencing the component's gameObject DebugPro.Log(" ======== DEBUGGING LIST: ======== "); List <int> listInts = arrayInts.ToList(); DebugPro.LogEnumerable(listInts); // Array with no message and default separator DebugPro.LogEnumerable(listInts, " | "); // List with no message DebugPro.LogEnumerable(listInts, " - ", "Message printed before the list list: "); // List with message DebugPro.LogEnumerable(listInts, " / ", "Message printed before the list list: ", this); // List with message and referencing the component's gameObject }
void Update() { // Random bool if (Input.GetKey(keyRandomBool)) { bool obtainedBool = easyRandom.GetRandomBool(0.5f); if (obtainedBool) { trueBooleans++; } else { falseBooleans++; } Debug.Log("The gotten value is " + obtainedBool + ". Average = " + (trueBooleans * 100f / (trueBooleans + falseBooleans)) + "%"); } // Random float if (Input.GetKey(keyRandomFloat)) { Debug.Log("The gotten value is " + easyRandom.GetRandomFloat(3.5f, 5.0f)); } // Pseudo-random distribution example (and testing) // An image of how the results should distribute (in blue): https://gamepedia.cursecdn.com/dota2_gamepedia/8/8b/AttacksUntilNextProc25.jpg?version=459537150af02c929fd939495fa78033 if (Input.GetKey(keyPseudoRandom)) { // You can use this code to better understand what is the result of each "RandomBool" method bool result = easyRandom.GetPseudoRandomDistributedBool(tryNumberSinceLastPositive, 0.25f); //bool result = random.GetPseudoRandomBool(tryNumber, 15); //bool result = random.GetRandomBool(0.2f); randomResults.Add(result); if (result) { workingTryNumbers.Add(tryNumberSinceLastPositive); if (tryNumberSinceLastPositive > maxTryNumber) { maxTryNumber = tryNumberSinceLastPositive; } tryNumberSinceLastPositive = 0; } else { tryNumberSinceLastPositive++; } int[] stats = new int[maxTryNumber]; foreach (int regTry in workingTryNumbers) { stats[regTry - 1]++; } int contador = 0; foreach (bool r in randomResults) { if (r) { contador++; } } Debug.Log("Percentage of positive values: " + (float)contador / (float)randomResults.Count + ". Try with the maximum value: " + maxTryNumber + ". Average needed quantity of tries:" + (workingTryNumbers.Count > 0 ? workingTryNumbers.Average() : 0.0)); DebugPro.LogEnumerable(stats, ", ", "STATS: "); } }