we should consider adding precision and scale to AQRandomFactory.nextBigDecimal(). Should also consider doing the same to AQBigDecimalFactory as well. This came up because i was trying to add random data to columns of data type decimal but was not able because of precision and scale.
(minPrecision, maxPrecision, minScale, maxScale)
/**
* Returns a {@link java.math.BigDecimal} object initialized with a random, non-negative value.
* The scale and precision of the returning value falls within range determined by the method arguments.
*
* @param minPrecision Minimum of the precision range (must be greater than 0)
* @param maxPrecision Maximum of the precision range (must be greater or equal than minPrecision)
* @param minScale Minimum of the scale range (must be greater or equal to 0)
* @param maxScale Maximum of the scale range (must be greater or equal than minScale)
*/
public BigDecimal nextBigDecimal(int minPrecision, int maxPrecision, int minScale, int maxScale);
/**
* Returns a {@link java.math.BigDecimal} object initialized with a random, non-negative value.
* The scale and precision of the returning value falls within range determined by the method arguments.
*
* @param minPrecision Minimum of the precision range (must be greater than 0)
* @param maxPrecision Maximum of the precision range (must be greater or equal than minPrecision)
* @param minScale Minimum of the scale range (must be greater or equal to 0)
* @param maxScale Maximum of the scale range (must be greater or equal than minScale)
*/
public BigDecimal nextBigDecimal(int minPrecision, int maxPrecision, int minScale, int maxScale);
for(i=0; i<100; i++)
{
print(aqua.random.nextBigDecimal(1,20,0,10));
}
for(i=0; i<100; i++)
{
print(aqua.random.nextBigDecimal(1,20,0,10));
}
I tested with this script
for(i=0; i<100; i++){
print(aqua.random.nextBigDecimal(10,10,5,5));
}
This is the 1st 10 lines of output
59551.69458
30441.71188
61178.76050
24799.80704
2721.63069
51577.98944
96389.68852
36952.53570
80810.90642
5505.41614
....
If I set the min/max precision to 10 and the min/max scale to 5, should all outputs be between 10000.00000 and 99999.99999?
I tested with this script
for(i=0; i<100; i++){
print(aqua.random.nextBigDecimal(10,10,5,5));
}
This is the 1st 10 lines of output
59551.69458
30441.71188
61178.76050
24799.80704
2721.63069
51577.98944
96389.68852
36952.53570
80810.90642
5505.41614
....
If I set the min/max precision to 10 and the min/max scale to 5, should all outputs be between 10000.00000 and 99999.99999?
I don't think so:
02721.63069
theoretically, it should return anything in the range
00000.00000 ... 99999.99999
I don't think so:
02721.63069
theoretically, it should return anything in the range
00000.00000 ... 99999.99999
Issue #4117 |
Closed |
Fixed |
Resolved |
Completion |
No due date |
No fixed build |
No time estimate |
(minPrecision, maxPrecision, minScale, maxScale)