/// <summary>
        /// Randomizes each value in the DNA using a Gaussian distribution.
        /// </summary>
        /// <param name="data">UMA data.</param>
        public void RandomizeDNAGaussian(UMAData data)
        {
            if (dnaConverter == null)
            {
                return;
            }

            UMADnaBase dna = data.GetDna(dnaConverter.DNATypeHash);

            if (dna == null)
            {
                return;
            }

            int entryCount = dna.Count;

            if (means.Length != entryCount)
            {
                Debug.LogWarning("Range settings out of sync with DNA, cannot apply!");
                return;
            }

            if (values == null)
            {
                values = new float[entryCount];
            }

            for (int i = 0; i < entryCount; i++)
            {
                values[i] = UMAUtils.GaussianRandom(means[i], deviations[i]);
            }

            dna.Values = values;
        }
Beispiel #2
0
        /// <summary>
        /// Randomizes each value in the DNA using a Gaussian distribution.
        /// </summary>
        /// <param name="data">UMA data.</param>
        public void RandomizeDNAGaussian(UMAData data)
        {
            if (dnaConverter == null)
            {
                return;
            }

            UMADnaBase dna = data.GetDna(dnaConverter.DNATypeHash);

            if (dna == null)
            {
                return;
            }

            int entryCount = dna.Count;

            if (values == null)
            {
                values = new float[entryCount];
            }

            for (int i = 0; i < entryCount; i++)
            {
                if (i < means.Length)
                {
                    values[i] = UMAUtils.GaussianRandom(means[i], deviations[i]);
                }
            }

            dna.Values = values;
        }