lundi 18 octobre 2021

How to select n unique elements at random, from a list of elements in Julia

I want to generate n unique elements from a list of numbers. I came across this answer but that only gives me one element. I want n distinct elements from the list.

How do I go about doing this?

I have tried using rand(list,n) but this sometimes gives me repeated elements from list so that doesn't work.




Aucun commentaire:

Enregistrer un commentaire