四、robotframework生成几种随机数
1.random()生成0<=n<1之间的随机实数--它会生成一个随机的浮点数,范围是在0.0~1.0之间。:
${num} evaluate random.random() random
log ${num}
-----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
2.choice(seq)从序列中返回随机的元素:
${a1} evaluate random.choice(['130','133','187','159','180','177','150','156','aaa']) random
-----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
3.random.uniform(a,b)正好弥补了1中函数的不足,它可以设定浮点数的范围,一个是上限,一个是下限
${a2} evaluate random.uniform(1.5,5.6) random
-----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
4.random.randint(a,b):随机生一个整数int类型,可以指定这个整数的范围,同样有上限和下限值
${a3} evaluate random.randint(1000,9999) random
-----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
5.random.sample()---sample(seq, n) 从序列seq中选择n个随机且独立的元素;
${a6} evaluate random.sample("0123456789",5) random,string
${a7} evaluate "".join(random.sample("0123456789",5)) random,string
------------------------------