I want to draw a number from a set of frequencies until all values are zero. By drawing the frequencies of the remaining numbers is decreasing. In R there is a "simple" function sample to do that for me. In C++ I found the std::discrete_distribution but not very much detail information about it
- I can't find a clear descrition of the algorithm of R and / or the std::discrete_distribution to compare the functionality. Is the behavior the same? Can I solve my task with this C++ STDL?
- As I programmed other PRNG's non STDL - Which functionaltyof them is needed so they can be used together with std::discrete_distribution - cppreference and other sites/forums are there very silent to this
- On a second place in my code I need a similar behavior ( fixed frequencies for each draw ) I found nowhere a explicit extra invokation nor parameter to seperate both functionalities. DO I need to create a new instance with lowered parameters?! This is obviousliy a thing I can't belive...
actually I'm summing the frequencies (hold by a std::vector) up until random number is smaller or equal. As this is:
- ineffective in time / ressources
- I'm not really sure if this is statistically allowed
I hope to find a better solution with you help.
THANK YOU for your time, support and answers of course :)
Aucun commentaire:
Enregistrer un commentaire