Trường · Float

Trường · Float · number.float. Phương thức tạo · Ví dụ

number.float

Cài đặt trình tạo

Tạo dữ liệu để xem kết quả ở đây.

Tham số & Ví dụ

Returns a single random floating-point number, by default between 0.0 and 1.0. To change the range, pass a min and max value. To limit the number of decimal places, pass a multipleOf or fractionDigits parameter.

number.float(options?: number | { min?: number; max?: number; fractionDigits?: number; multipleOf?: number; distributor?: Distributor; })
options
Upper bound or options object.
options.min
Lower bound for generated number, inclusive. Defaults to 0.0.
options.max
Upper bound for generated number, exclusive, unless multipleOf or fractionDigits are passed. Defaults to 1.0.
options.multipleOf
The generated number will be a multiple of this parameter. Only one of multipleOf or fractionDigits should be passed.
options.fractionDigits
The maximum number of digits to appear after the decimal point, for example 2 will round to 2 decimal points. Only one of multipleOf or fractionDigits should be passed.
options.distributor
A function to determine the distribution of generated values. Defaults to uniformDistributor().

Ví dụ

0.6680253622145051

Dùng dữ liệu tổng hợp trong môi trường kiểm thử.

Trình tạo liên quan

Khám phá kịch bản