I know it is a noob question but i am quite stuck with it so i hope you can help me.I have an array with integers. Depending on circumstances i can have an array with 1,2,3 or 1,1,1 or 1,2,2 and so on. The important thing is that difference between values in array may be no bigger than smallest number + 2 (i can have there 1, 2, 3 but no 1, 2, 4). Now i grab max and min of array and decrement min from max. Because always the difference between max and min is 0, 1 or 2 (array values are no bigger from eachother than two) i have free possible chances:0: - all array values are equal1: - all array values are from range 2: - all array values are from range Now if i want to randomly choose values from above arrays it's quite easy. But how can i do it with percentage chance of selecting number with bigger probability than the others?What do i mean? Consider second example, and range of values in array x-1, x+1 - let it be Array(2, 3, 4). Now i would like to have 50% chance to select 4, 30% chance to select 3 and 20% to select 2. How can i connect value of integer in array with a chance of selecting it?I hope you can understand what I mean and you can help me.