   Weighted random function?
  I was wondering if anyone had some ideas on making a weighted random function like this:int WeightedRand(int maximum, int weight);An example:WeightedRand(255, 100) would return an integer from 0 to 255, and 255 is 100 times more likely to appear than 0 would be and the probabilty of a number appearing goes up steadily.  In other words, the probability of a number appearing would be directly proportional to that number.I already solved this problem in my program, by using a quick and dirty rand() and breaking it into ranges and making different probabilities for the ranges, but I know there''s a more general and adaptable and elegant solution, my brain is just too tired to think of it at the moment. 
  My first thought would be use  boost::random with a triangle_distribution. 