Project

General

Profile

Feature #3647

Updated by nobu (Nobuyoshi Nakada) over 4 years ago

`Array#sample` =begin 
  Array#sample does not support sampling with replacement directly, so we must write codes like the following to obtain samples with replacement. 

 ```ruby 
 
 
    samples_with_replacement = n.times.map { source.sample } 
 ``` 
 
 
 
  If `Array#sample` Array#sample has the argument for switching with/without replacement, we can write it as follow. 
 
 ```ruby 
 
 
    samples_with_replacement = source.sample(n, true) 
 ``` 
 
 
 
  The patch was attached.    Please consider to merge. 

 
 =end 

Back