JMeter:如何传递包含小数的随机数?

JMeter: How to pass random number that contains decimal?

我们必须在 8、8.5、9、9.5、10、10.5 之间随机传递值,直到 99。我该如何实现?

我听说 Groovy is the new black so you can use __groovy() function 实现了您的要求,例如:

${__groovy(new java.text.DecimalFormat('0.#').format(Math.ceil(org.apache.commons.lang3.RandomUtils.nextFloat(8.1f\, 99f) * 2) / 2),)}

参考文献: