krishnakumar kuna

krishnakumar kuna

  • 1.9k
  • 57
  • 31.4k

Select random item using weight

Sep 8 2014 11:23 AM
hello,
 
I want to select random items from a list with weight
 
like this
 item - weight
apple   -34
orange-37
strawberry-11
mango-8
banana -3.98
cherry-5.7
grape- 0.3
guava- 0.02
 
please help me with this if i use random generate method this grape and guava which has less than 1 is got as 1 used frequently which i should not want.
 
thanks 

Answers (2)