ruby 100.rb >temp.txt- 10.times {puts [*1..100].sample(100).join("\n")}
复制代码 脚本自己写文件:- File.open('temp.txt', 'w+') do |f|
- 10.times { f.write [*1..100].sample(10).sort.join(',') + "\n" }
- end
复制代码 或者:- File.open('temp2.txt', 'w+').write ( [*0..10].map { [*1..100].sample(10).sort.join(',') }.join("\n"))
复制代码
|