Esempio n. 1
0
        /// <summary>
        /// Generates one sample
        /// </summary>
        /// <returns>The generated sample</returns>
        public float Sample()
        {
            var rng = new Unity.Mathematics.Random(ScenarioBase.activeScenario.NextRandomState());

            return(SamplerUtility.TruncatedNormalSample(
                       rng.NextFloat(), range.minimum, range.maximum, mean, standardDeviation));
        }
Esempio n. 2
0
        /// <summary>
        /// Generates one sample
        /// </summary>
        /// <returns>The generated sample</returns>
        public float Sample()
        {
            Initialize();
            var rng = new Unity.Mathematics.Random(ScenarioBase.activeScenario.NextRandomState());

            return(SamplerUtility.AnimationCurveSample(
                       m_IntegratedCurve, rng.NextFloat(), m_Interval, m_StartTime, m_EndTime));
        }
Esempio n. 3
0
        void Initialize()
        {
            if (m_Initialized)
            {
                return;
            }

            Validate();
            m_IntegratedCurve = new float[numOfSamplesForIntegration];
            SamplerUtility.IntegrateCurve(m_IntegratedCurve, distributionCurve);
            m_StartTime   = distributionCurve.keys[0].time;
            m_EndTime     = distributionCurve.keys[distributionCurve.length - 1].time;
            m_Interval    = (m_EndTime - m_StartTime) / (numOfSamplesForIntegration - 1);
            m_Initialized = true;
        }