I am trying to simulate an auction bid from a bidder which I know bids between 1250 and 2200, and most often bid 1700.
Is there any way to use the randbetween()
for this type of problem with a most common value?
CodePudding user response:
I'm writing my answer in pseudocode (it won't even compile, it's just for giving you an idea).
There are different ways to get what you want: you can create an array of possible values and add the most probable value multiple times, like in this example:
values_array=[1, 2, 3, 4, 5, 5, 5, 6, 7, 8, 9, 10] // value "5" is three times more probable to be picked.
value = values_array[RAND(Length(values_array))]
Another approach:
temp_rand = RAND();
if (temp_rand <= 0.9)
then result = RANDBETWEEN(1250,2200)
else result = 1700
Good luck
CodePudding user response:
How about separating the range of data and weighting e.g. 3 group > 25%, 50%, 25%
=((0.25)*RANDBETWEEN(1250,1500)) ((0.50)*RANDBETWEEN(1501,1800)) (0.25)*RANDBETWEEN(1801,2200)
CodePudding user response:
If you want to use a distribution for the bids, then you could use numpy Random Generator for random sampling. With this, though, you would need to discard values outside the range.