I am trying to implement Stochastic pooling. But I am very much unclear about how to sample from a multi-nominal distribution to get the location from where we need to pool. Could you please provide any example code?