• 生成指定范围内的随机数

    Parameters

    • min: number

      随机数的下限(包含)

    • max: number

      随机数的上限(不包含)

    • Optional options: GetRandomNumberOptions

      可选配置项,包括小数点后保留的位数

    Returns number

    在指定范围内的随机数,根据options配置四舍五入到指定的小数位

    Example

    import { numHelper } from "@pointcloud/pcloud-utils"
    numHelper.getRandomNumber(1, 10, { toFixed: 2 }) // 生成1到10之间的随机数,保留两位小数

Generated using TypeDoc