# Timeline for Generating random data from a discrete multimodal distribution

### Current License: CC BY-SA 4.0

4 events
when toggle format what by license comment
Nov 5 '20 at 15:35 comment @TMat yup that's exactly what happened when I tested this with a more complex image. Worked a charm! Thanks!
Nov 5 '20 at 15:35 comment try to check that img[xy[9]] corresponds to prob[9] (up to normalization) when img is not symmetric (img.T != img). Maybe I am wrong, I didn't check myself.
Nov 5 '20 at 15:32 comment Yes it is exactly so. Your numpy implementation is great the only tricky part is to be sure that your first flatten (for the probability) gives the same enumeration as the flatten then vstack you used to construct xy. And I wonder if you do not have a problem there, using your code I think I would have used the transposed matrix prob = (np.array(img)/np.sum(img)).T.flatten() or something like that. As is, I beleive you exchanged the columns and the lines but in your case this has no consequence because the image seems to be symmetric.
Nov 5 '20 at 14:57 history answered