@Float()
New in 2.0Generate random float values (4 bytes)
Data TypesSince 2.0.0
Parameters
| Name | Type | Required | Default | Description |
|---|---|---|---|---|
| min | Float | — | 0 | Minimum value, default 0.0 |
| max | Float | — | 3.40282346638528860e+38 | Maximum value, default 3.40282346638528860e+38 |
| scale | Integer | — | 2 | Precision digits, default 2 |
| nullSampler | String | — | — | The null ratio, such as "1:2", indicates that generating a random value 3 times with an average of 1 time is null |
Usage
@Float()Generate random float between 0 and 3.40282346638528860e+38
Example:
@Float()
Output:
1.2222222@Float(nullWeight)Generate random float between 0 and 3.40282346638528860e+38 with null ratio
Example:
@Float(1:2)
Output:
1.2222222@Float(scale)Generate random float between 0 and 3.40282346638528860e+38 with specified precision
Example:
@Float(5)
Output:
87901.011273092290435.18326@Float(min,max)Generate random float between min and max
Example:
@Float(5,15)
Output:
5.2222222@Float(min,max,scale,nullWeight)Full parameter constructor, see complete parameter documentation
Example:
@Float(0,10,5,1:2)
Output:
1.22222@Float(min,max,scale)Generate random float between min and max with specified precision
Example:
@Float(5,15,2)
Output:
5.22