So basically I want to generate a 300-elements array given a range [5,6,7,8,9] with according probability [0.1,0.1,0.4,0.3,0.1]. So for example, the probability to get 5 is 0.1.