JuliaStats/Distributions.jl — pull request #108 by lindahua (2013-07-19 16:04:26+00:00)
Title: New sample function

I have re-worked the sample function, which now supports:
- draw a single element
- sample with replacement
- sample without replacement
- weighted sample

Interfaces:
```julia
sample(a) # randomly draw an element in a
sample(a, w) # randomly draw an element in a with weights w
sample!(a, x; replace=true|false) # write samples from a to x
sample(a, dims; replace=true|false) # create an array of samples from a
sample!(a, w, x) # sampling to x (with weights)
sample(a, w, dims) # create an array of samples from a (weighted)
```

Weighted sampling without replacement is more complex. We may do it later, using the syntax ``sample(a, w, dims; replace=false)``.

I am requesting for comments before merge it to master.