void Update() { // Random bool if (Input.GetKey(keyRandomBool)) { Debug.Log("The gotten value is " + random.GetRandomBool(0.5f)); } // Random float if (Input.GetKey(keyRandomFloat)) { Debug.Log("The gotten value is " + random.GetRandomFloat(3.5f, 5.0f)); } // Pseudo random example (and testing) if (Input.GetKey(keyPseudoRandom)) { // You can use this code to better understand what is the result of each "RandomBool" method bool result = random.GetPseudoRandomBool(tryNumber, 0.2f); //bool result = random.GetPseudoRandomBool(tryNumber, 15); //bool result = random.GetRandomBool(0.2f); randomResults.Add(result); if (result) { workingTryNumbers.Add(tryNumber); if (tryNumber > maxTryNumber) { maxTryNumber = tryNumber; } tryNumber = 0; } else { tryNumber++; } int[] stats = new int[maxTryNumber]; foreach (int regTry in workingTryNumbers) { stats[regTry - 1]++; } int contador = 0; foreach (var 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.Log(stats, "STATS: "); } }
void Start() { DebugPro.Log(" ======== DEBUGGING ARRAY: ======== "); int[] arrayInts = { 1, 2, 3, 4, 5, 6, 7, 8 }; DebugPro.Log(arrayInts); // Array with no message DebugPro.Log(arrayInts, "Message printed before the list array: "); // Array with message DebugPro.Log(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.Log(listInts, ""); // List with no message DebugPro.Log(listInts, "Message printed before the list list: "); // List with message DebugPro.Log(listInts, "Message printed before the list list: ", this); // List with message and referencing the component's gameObject }