w1983912 当前离线
五级士官
codegay 当前离线
少校
import random import strutils import algorithm randomize() var myseqs = newSeq[int](0) var ran:int var f = open("temp.txt",fmWrite) for c in 1..100: myseqs = newSeq[int](0) while myseqs.len != 10: ran = random(1..101) if ran notin myseqs: myseqs.add(ran) f.writeLine join(sorted(myseqs,cmp[int]),",") f.close() for r in lines "temp.txt": echo r复制代码
TOP
slore 当前离线
上尉
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")) 复制代码
import random with open("temp.txt", "w") as f: for r in range(100): t = random.sample(range(1, 101), 10) t.sort() f.write(",".join([str(i) for i in t]) + "\n")复制代码
import random with open("temp.txt", "w") as f: for r in range(100): f.write(",".join([str(i) for i in sorted(random.sample(range(1, 101), 10))]) + "\n")复制代码
评分人数