*/
class CRM_Utils_Number {
/**
- * Create a random number with a given precision
+ * Create a random number with a given precision.
*
- * @param array $precision (int $significantDigits, int $postDecimalDigits)
+ * @param array $precision
+ * (int $significantDigits, int $postDecimalDigits).
*
* @return float
* @link https://dev.mysql.com/doc/refman/5.1/en/fixed-point-types.html
*/
- static function createRandomDecimal($precision) {
+ public static function createRandomDecimal($precision) {
list ($sigFigs, $decFigs) = $precision;
$rand = rand(0, pow(10, $sigFigs) - 1);
return $rand / pow(10, $decFigs);
* and/or move the decimal place.
*
* @param int|float $keyValue
- * @param array $precision (int $significantDigits, int $postDecimalDigits)
+ * @param array $precision
+ * (int $significantDigits, int $postDecimalDigits).
* @return float
* @link https://dev.mysql.com/doc/refman/5.1/en/fixed-point-types.html
*/
- static function createTruncatedDecimal($keyValue, $precision) {
+ public static function createTruncatedDecimal($keyValue, $precision) {
list ($sigFigs, $decFigs) = $precision;
$sign = ($keyValue < 0) ? '-1' : 1;
$val = str_replace('.', '', abs($keyValue)); // ex: -123.456 ==> 123456
return $sign * $val;
}
}
+
}