# Question:Selecting numbers from random bins

## Question:Selecting numbers from random bins

Maple

Dear people at Mapleprimes

My situation is the following: I have a number of bins (n bins), which all contain a specific number. I want to choose at random from these bins a number of times (N times), but in such a way that it is not equal likely that I choose from bin1, bin2 ...

Example: I have 5 bins: The 5 bins contains the numbers 50, 60, 70, 80, 90 respectively. The probabilities of choosing from these 5 bins should be 0.10, 0.30, 0.20, 0.25, 0.15 respectively. I make N = 100 selections. The output is expected to be a list with 100 numbers, for example: [ 50, 80, 80, 60, 60, 90, 50, ... , 70].

I could make it work myself by picking a random number from the uniform distribution from 0 to 1 and deciding if the a random number is between 0 and 0.10, between 0.10 and 0.40, between 0.40 and 0.60, etc. and then choosing the number in the corresponding bin ... I just wonder if Maple has an elegant way to to it?

Regards,

Erik

﻿