I'm trying to generate a random double in R between 0 and 100, with 0 being a possible result, and normally runif(1, min, max) would do what I need. However, if I understand it correctly runif will only give you results between the min and max and never the actual limits.
Is there in R to generate a random double that does include only one of the limits? (In this case, 0≤x<100)
josliber created a custom function that includes both limits (https://stackoverflow.com/a/24070116/6429759), but I'm afraid that I don't know if this can be modified to only include min.
I do realise this would only change the outcome an extremely small amount of the time, but it's part of a function that will be run extremely frequently, so it's not for nothing.
Many thanks.
Aucun commentaire:
Enregistrer un commentaire