By using rand()
function, we can create a possibility of an output.
Like rand()%4 + 'A'
basically means this code will generate random alphabets from A to D.
Then my question is, can we put "possibility rate" into this random generation?
Such as, for A to come out among 4 Alphabets ( from A to D), there only will be 24% chance
while B will come out at 12% rate, etc.
- I am using Windows and my program for coding is Visual Studio 2012. (The language is C)