更新时间:2023-08-27 21:54:46
您可以使用 __ groovy()函数,相关代码如下:
You can generate a random float value using either any of JSR223 Test Elements and Groovy language or __groovy() function, the relevant code would be something like:
org.apache.commons.lang3.RandomUtils.nextFloat(0.0f, 100f)
对于_groovy()函数,您需要转义逗号,例如:
${__groovy(org.apache.commons.lang3.RandomUtils.nextFloat(0.0f\, 100f),)}
它将返回一个介于0到100之间的随机浮点数(根据需要进行调整)
it will return a random float number in range from 0 to 100 (adjust as needed)
演示:
更多信息:数学函数与转换Groovy中的数据类型