random: use nths-unsafe in sample.
parent
775fc57d30
commit
206d42c930
|
|
@ -116,7 +116,7 @@ ERROR: too-many-samples seq n ;
|
||||||
: sample ( seq n -- seq' )
|
: sample ( seq n -- seq' )
|
||||||
2dup [ length ] dip < [ too-many-samples ] when
|
2dup [ length ] dip < [ too-many-samples ] when
|
||||||
[ [ length iota >array ] dip [ randomize-n-last ] keep tail-slice* ]
|
[ [ length iota >array ] dip [ randomize-n-last ] keep tail-slice* ]
|
||||||
[ drop ] 2bi nths ;
|
[ drop ] 2bi nths-unsafe ;
|
||||||
|
|
||||||
: delete-random ( seq -- elt )
|
: delete-random ( seq -- elt )
|
||||||
[ length random-integer ] keep
|
[ length random-integer ] keep
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue