Gems/WhiteBox/Code/Tests/WhiteBoxUVTest.cpp
float GenerateNoiseWithSignificantFigures(AZ::u32 afterDecimalPlace)
    {
        // number of significant figures of randomness to generate
        const double numSigFigs = 8;

        // scaling factor to push the noise back into the desired range
        const double sigFactor = std::pow(10.0, numSigFigs + afterDecimalPlace);

        // random value for first guaranteed significant digit
        const auto firstSigFig = azlossy_cast<AZ::u64>(rndFirstSigFig(gen)) * std::pow(10.0, numSigFigs - 1);

        // random value for the other significant digits
        const auto otherSigFigs = azlossy_cast<AZ::u64>(rndOtherSigFigs(gen) * std::pow(10.0, numSigFigs - 1));

        // unscaled random value with rndSigFigs significant figures
        const auto fixedLengthRandom = firstSigFig + otherSigFigs;

        // scaled random value to push the noise into the desired significant digit range
        const float noise = aznumeric_cast<float>(fixedLengthRandom / sigFactor);

        return noise;
    }
// generate noise after the specified decimal place with the first significant
// figure always being one decimal place after afterDecimalPlace
generate noise after the specified decimal place with the first significant
figure always being one decimal place after afterDecimalPlace
generate noise after the specified decimal place with the first significant figure always being one decimal place after afterDecimalPlace
float GenerateNoiseWithSignificantFigures(AZ::u32 afterDecimalPlace)
    {
        const double numSigFigs = 8;
        const double sigFactor = std::pow(10.0, numSigFigs + afterDecimalPlace);
        const auto firstSigFig = azlossy_cast<AZ::u64>(rndFirstSigFig(gen)) * std::pow(10.0, numSigFigs - 1);
        const auto otherSigFigs = azlossy_cast<AZ::u64>(rndOtherSigFigs(gen) * std::pow(10.0, numSigFigs - 1));
        const auto fixedLengthRandom = firstSigFig + otherSigFigs;
        const float noise = aznumeric_cast<float>(fixedLengthRandom / sigFactor);
        return noise;
    }
float GenerateNoiseWithSignificantFigures ( AZ :: u32 afterDecimalPlace ) { const double numSigFigs = 8 ; const double sigFactor = std :: pow ( 10.0 , numSigFigs + afterDecimalPlace ) ; const auto firstSigFig = azlossy_cast < AZ :: u64 > ( rndFirstSigFig ( gen ) ) * std :: pow ( 10.0 , numSigFigs - 1 ) ; const auto otherSigFigs = azlossy_cast < AZ :: u64 > ( rndOtherSigFigs ( gen ) * std :: pow ( 10.0 , numSigFigs - 1 ) ) ; const auto fixedLengthRandom = firstSigFig + otherSigFigs ; const float noise = aznumeric_cast < float > ( fixedLengthRandom / sigFactor ) ; return noise ; }
generate noise after the specified decimal place with the first significant
figure always being one decimal place after afterDecimalPlace
generate noise after the specified decimal place with the first significant figure always being one decimal place after afterDecimalPlace
// number of significant figures of randomness to generate // scaling factor to push the noise back into the desired range // random value for first guaranteed significant digit // random value for the other significant digits // unscaled random value with rndSigFigs significant figures // scaled random value to push the noise into the desired significant digit range