jeudi 28 décembre 2017

Mathematical function that has more chance to return small number, than large

I need to get random element in array, but I want to get element with smaller index more frequently than element with large index. Is there any way to do that?

Example: sqrt(x) will return big indexes frequently

1: 1 2: 2 3: 2 4: 2




Aucun commentaire:

Enregistrer un commentaire