
Security News
Axios Supply Chain Attack Reaches OpenAI macOS Signing Pipeline, Forces Certificate Rotation
OpenAI rotated macOS signing certificates after a malicious Axios package reached its CI pipeline in a broader software supply chain attack.
@woodenfish/random-data
Advanced tools
这是一个字符串拼接工具,可以用于OJ的测试数据生成, 点我在线体验。
cli 工具用法见 cli使用指北
现在只支持两种语句
constraint 约束 限制变量取值
repeat 重复 会输出内容
重要 每一个变量都需要有约束
constraint 变量名 int 最小值 最大值
比如
constraint n int 1 233
变量名 最好都是字母(汉字也行)
最小值和最大值可以是别的变量名
区间是左闭右开
constraint 变量名 set value1 value2 value3
比如
constraint 数字 set 一 二 三 四
value之间使用空格分隔
repeat 重复次数 重复的内容
重复次数 可以是一个数字,也可以是一个变量
从紧跟 重复次数 的空格后面开始,到这一行结束都会被视为一个模板,我们使用 ${变量名} 来引用一个变量
比如
repeat 1 ${n}
亦或者
repeat 1 prefix string ${n}
都是被允许的
repeat group 重复次数
repeat line
repeat line
repeat line
end group
重复次数 可以是一个数字,也可以是一个变量
举个例子,假如我们的数据是
第一行输入一个n,代表接下来有n行数据,每行数据有三个数a b c
那么就是
repeat 1 ${n}
repeat n ${a} ${b} ${c}
然后补充一下约束就好了
再举一个例子
假如我们的数据是这个样子的
第一行是n,代表接下来有n组数据
每组数据的第一行有三个数row min max,代表接下来有row个数字,每个数字的取值是 [min, max)
那我们可以这样写
constraint n int 5 10
constraint row int 10 20
constraint min int 150 200
constraint max int 500 1000
constraint num int min max
repeat 1 ${n}
repeat group n
repeat 1 ${row} ${min} ${max}
repeat row ${num}
end group
来一个set的例子
constraint 姓 set 赵 钱 孙 李
constraint 名 set 一 二 三 四
repeat 10 ${姓}${名}
当然,本质是个字符串拼接,也可以写别的东西
constraint 姓 set 赵 钱 孙 李
constraint 名 set 一 二 三 四
constraint value int 10 1000
constraint status int 0 2
repeat 10 INSERT INTO list (name, value, status) VALUES ("${姓}${名}", ${value}, ${status});
程序没有检查输入是否合法,所以需要你自己注意一下 :)
图、flags 这些的使用,参见 高级用法
参见 更新日志
不存在的
这个轮子的目的是设计一个足够简单的工具来生成数据,这也就意味着她不能支持所有的场景,也不能对数据做高度定制。
如果有这种需求的话,应该自己写代码,或者使用类似 CYaRon 的工具。
FAQs
We found that @woodenfish/random-data demonstrated a not healthy version release cadence and project activity because the last version was released a year ago. It has 1 open source maintainer collaborating on the project.
Did you know?

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Security News
OpenAI rotated macOS signing certificates after a malicious Axios package reached its CI pipeline in a broader software supply chain attack.

Security News
Open source is under attack because of how much value it creates. It has been the foundation of every major software innovation for the last three decades. This is not the time to walk away from it.

Security News
Socket CEO Feross Aboukhadijeh breaks down how North Korea hijacked Axios and what it means for the future of software supply chain security.