加入收藏 | 设为首页 | 会员中心 | 我要投稿 李大同 (https://www.lidatong.com.cn/)- 科技、建站、经验、云计算、5G、大数据,站长网!
当前位置: 首页 > 百科 > 正文

怎样让xml文件的属性值随机生成

发布时间:2020-12-15 22:24:43 所属栏目:百科 来源:网络整理
导读:怎样让xml文件的属性值随机生成 如:requestjabber type="raw" ack="no_ack" data="lt;message id='a98d8bed-ac21-4851-a8b3-6e4bd6523174' to='xm@dc01' //request id为随机值,而不是固定值 解答: 首先dtd文件里要有random属性 然后设置random="true" 如

怎样让xml文件的属性值随机生成


如:<request><jabber type="raw" ack="no_ack" data="&lt;message id='a98d8bed-ac21-4851-a8b3-6e4bd6523174' to='xm@dc01' ><//request> id为随机值,而不是固定值




解答:

首先dtd文件里要有random属性

然后设置random="true"

<thinktime min="2" max="10" random="true"></thinktime>
这时 thinktime的取值为2-10之间

If you want to use a fixed seed for the random generator,you can use the seed option,like this (by default,tsung will
use the current time to set the seed,therefore random numbers should be different for every test)

如果你想使用一个固定的种子随机发生器,你可以使用种子标签option,tsung使用当前时间,设置种子,这样随机数每次都不一样
<option name="seed" value="42"/>

搞定

前提条件,解析此xml的工具或软件得支持random关键字,并对其进行随机策略处理。

(编辑:李大同)

【声明】本站内容均来自网络,其相关言论仅代表作者个人观点,不代表本站立场。若无意侵犯到您的权利,请及时与联系站长删除相关内容!

    推荐文章
      热点阅读