special random number

c#, numbers, random

Solution

You need a distribution function that takes a number between 0 and 1 and converts it to a number in the range you want, with a higher weight on a specific number. You could create such a function with trigonometric functions (sin, cos, ...), exponential, or maybe a polynomial.

UPDATE: Have a look at this page for more information on probability distribution

Problem

I'd like to have a random number like this:(in C#) ``` Random r = new Random(); r.next (0,10) ``` BUT it's important to the random number be more near 8,(or it be usually big), I mean if we use a for: ``` for (int i =0; i<...;i++) { write: r.next (0,10) } ``` the result be like this; ``` 8 7 6 9 1 0 5 3 2 2 3 8 9 7 7 6 2 3 8 8 9 7 2 8 2 8 4 3 ```

Original source

Related problems