Roulette wheel style selection from Array

Hello! Thank you for the suggestion. I ended up with the following solution. Do you think it is OK? I feed an array of floats and get a random index that also takes into the account their weight.