Solved

# Generating random-ish numbers

Posted on 2001-07-27

I wish to generate random-ish numbers. Each number has a different probability of being generated than others, depending on how they are rated. i.e. an array contains the probability of that number being generated, the higher the number, the more chance it has of appearing. eg:

int numberList[10] = {1,2,3,4,5,6,7,8,9,10};

int numberProbability[10] = {10,5,7,9,2,1,6,8,3,4};

1 (rated at 10) has a far higher chance of being generated than 6 (rated at 1) or 10 (rated at 4).

Any help would be greatly appreciated. Thanks!!