this should work (generate all the combinations of n dice each with m sides)

Crappy and a little ad-hoc, and no sign of a recursive but it works for most counts.
…could do with handling multiple dice types throwdice(2,3,5,6,6,6,6) and maybe extend it to use a file instead of an array in memory(??).
Still it can push out a prodigious amount of numbers.

#include 
#include 
#include 
#include 
using namespace std;

int throwDice(int intDices,int DiceSides);
long dicecount=7;
int MaxSides=9; //3
long nRows=(int)pow(MaxSides,dicecount);

int* history=new int[nRows * dicecount]; //create a very large 1 dimensional array

int sum=0;
int main()
{

  for (int j=0;j
					

Handy Packages for R

Packages:
lattice
envelope
doBy
RODBC
fArma
BayesX
car
maptools
RColorBrewer

install.packages("lattice", dependencies = TRUE)
install.packages("envelope", dependencies = TRUE)
install.packages("doBy", dependencies = TRUE)
install.packages("RODBC", dependencies = TRUE)
install.packages("fArma", dependencies = TRUE)
install.packages("BayesX", dependencies = TRUE)
install.packages("car", dependencies = TRUE)
install.packages("maptools", dependencies = TRUE)
install.packages("KernSmooth", dependencies = TRUE)
install.packages("RColorBrewer", dependencies = TRUE)

or in one command…

install.packages(c("rJava","lattice","Cairo","xlsx","treemap","RODBC","maptools","doBy","car","RColorBrewer","envelope","BayesX", "KernSmooth"), dependencies = T, repos = "http://cran.fhcrc.org")