0
这就是我想出的,但我觉得有更好的方法。我也听说我不应该使用open-uri。如何捕获来自HTTP GET请求的响应
require 'open-uri'
min = 1
max = 1000
str = open("http://www.random.org/integers/?num=#{min}&min=1&max=#{max}&col=1&base=10&format=plain&rnd=new").read
puts str.chomp.to_i
这种方式怎么了? –