Module: Statsample::Resample

Defined in:
lib/statsample/resample.rb

Class Method Summary collapse

Class Method Details

.generate(size, low, upper) ⇒ Object


8
9
10
11
# File 'lib/statsample/resample.rb', line 8

def generate (size,low,upper)
  range=upper-low+1
  Daru::Vector.new((0...size).collect {|x| rand(range)+low })
end

.repeat_and_save(times, &action) ⇒ Object


4
5
6
# File 'lib/statsample/resample.rb', line 4

def repeat_and_save(times,&action)
  (1..times).inject([]) {|a,x| a.push(action.call); a}
end