简体   繁体   中英

jmeter and random number distribution

I would like to use jmeter, but I need to get it to generate random numbers using a gaussian distribution. Any idea on how to achieve that? All I can see is a Minimum Value and a Maximum Value for the random variable config element

Thanks

Use JSR223 Pre or Post processor depend on your requirement to generate random using Gaussian distribution. Below is the code:-

rnd = new Random()
result = (1..1000).inject([]) { r, i -> r << rnd.nextGaussian() }

log.info ">>>>>>>>>>>>>>>>>"+result

Below is the reference from where I have got this. https://rosettacode.org/wiki/Random_numbers#Groovy

One more reference, for Java and many others:- http://www.cs.yale.edu/homes/spielman/ECC/gauss.html

Hope this helps.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM