vendredi 26 février 2021

Generate random numbers with given expected number of repetitions

Given n and r. Generate n random numbers between [0,1] with the expected number of repetitions r.
The method that is recommended for this is to choose a random number between [0,1] and
chose it's a number of repetitions between [1,2r]. Not sure how choosing repetitions between
[1,2r] will lead to a total expected number of repetitions to r.
To generate a random value it seems one could use Math.random() function in JAVA.

Also choosing when we are choosing the repetitions between [1,2r]. suppose the repetition is 3
Then does one choose the next n-1 numbers or n-3 numbers so that the expected number of repetitions
remain r.




Aucun commentaire:

Enregistrer un commentaire