samedi 16 octobre 2021

How to attribuate a certain probability to each event using sample()

mystring<- sample (1:3, size=100)

I want to generate randomly this string of numbers, but I want that the probability of 2 to be 0.25 and those of 1 and 3 to be 0.375 and 0.375 respectively.




Aucun commentaire:

Enregistrer un commentaire