dimanche 13 septembre 2015

Random number in LUA script Load Impact

This is my first time in both LoadImpact and LUA script. So i will try to explain my self :)

I'm trying to create a random number generator in LUA. I found out that i can just use math.random(1,100) to randomize a number between 1 and 100 and that should be sufficient.

But I don't really understand how to use the randomize number as variables in the script.

Tried this but of course it didn't work :) Any tips

 $randomCorr = math.random(1,100);

http.request_batch({
    {"POST", "http://ift.tt/1QaJBRr", headers={["Content-Type"]="application/json;charset=UTF-8"}, data="{\"ChoosenPhoneModelId\":4,\"PricePlanId\":\"phone\",\"CorrelationId\":\"$randomCorr\",\"DeliveryTime\":\"1 vecka\",\"$$hashKey\":\"006\"},\"ChoosenAmortization\":{\"AmortizationLength\":0,\"ChoosenDataPackage\":{\"Description\":\"6 GB\",\"PricePerMountInKr\":245,\"DataAmountInGb\":6,\"$$hashKey\":\"00W\"},\"ChoosenPriceplan\":{\"IsPostpaid\":true,\"Title\":\"Fastpris\",\"Description\":\"Fasta kostnader till fast pris\",\"MonthlyAmount\":0,\"AvailiableDataPackages\":null,\"SubscriptionBinding\":0,\"$$hashKey\":\"00K\"}}", auto_decompress=true},
    {"GET", "http://ift.tt/1NxqHqs", auto_decompress=true},
    })




Aucun commentaire:

Enregistrer un commentaire