I'm making a dice program that calculates the statistics such as actual percentage, expected rolls and expected percentage and so on. I'm having a difficulty on the Pseudo random number generation. With two dice, the mim. sum of the dice is 2, not 1. There is something wrong with my code so it keep generating the number 1 out.

Can anyone help me with that?

cout << "Enter seed: "; 
		cin >> seed; 
		cout << "Number of repeats: "; 
		cin >> intRepeats;  
		x = seed;   //x is the PRN, and the first is user selected  
		for (int i = 0; i < intRepeats; i++) 
			x = ((multiplies * x) + inciement) % modulus;    //CREATE A RANDOM NUMBER  
			num = x / float (modulus);  
			roll = int (num * 12) +1; 
			cout << "Dice roll was: " << roll << endl; 

[img] http://images.plurk.com/41fc82bc186ee5987fdfd4fcc78bc837.jpg [/img]

Edited 4 Years Ago by chuyauchi: n/a

Two possibilities.
A. roll=int(num*11)+2; //Just reduce the 12 to 11 and add 2 instead of 1.
B. rewrite it to roll a single die, save the value, then roll again.

This question has already been answered. Start a new discussion instead.