So Here is the code, I just copied and pasted it. If there is a better way to do this let me know. The code isn't 100% complete. I don't have it outputting the data yet or have it linked with the random number generator I want to use. Maybe that is the problem. I don't know. Thanks everyone for your help.
//
// The purpose of this program is to find the probabilities
// that Number of Particles will exist in the nth Spaces of
// the ring lattice with nNumberofSpaces
//
//
#include <Carbon/Carbon.h>
#include "TApplication.h"
#include "TWindow.h"
#include <iostream>
#include <ctime>
#include <cstdlib>
using namespace std;
double ran2();
int main()
{
int* Ring;
int* Location;
int numberOfSpaces = 0, numberOfParticles = 0, monteCarlo = 0, choice = 0;
char programEnd = 'R';
double alpha = 0, success = 0;
srand(time(0));
do
{
cout << "Enter the Number of Spaces in the Ring:" ;
cin >> numberOfSpaces;
cout << "Enter the number of particles: ";
cin >> numberOfParticles;
cout << "Choose a number, up to one decimal place to be alpha,\n"
<< "the rate at which the particles can move:";
cin >> alpha;
cout << "Enter the number of steps that you want the process to complete:";
cin >> monteCarlo;
// Creates Ring
Ring = new int[numberOfSpaces];
for(int i = 0; i < numberOfSpaces; i++)
{
Ring = 0;
}
//Places particles in the ring
for (int i = 1; i == numberOfParticles; i++)
{
Ring[i-1] = i;
}
//Stores Particle Placement on the Ring
Location = new int[numberOfParticles + 1];
for(int i = 0; i == numberOfParticles; i++)
{
Location = i-1;
}
//Runs the MonteCarlo Steps
for (int i = 0; i < monteCarlo; i++)
{
for (int i2 = 0; i2 < numberOfParticles; i2++)
{
choice = random() % numberOfParticles + 1;
if (Location[choice] != (Location[choice + 1] - 1))
{
success = random() % 100 + 1;
if(alpha >= success)
{
Ring[Location[choice] + 1] = choice;
Ring[Location[choice]] = 0;
Location[choice]++;
if (Location[choice] = numberOfSpaces - 1)
{
Location[choice] = 0;
}
}
}
}
}
cout << "Program is Finished. Enter R to rerun:" ;
cin >> ProgramEnd;
delete [] Ring;
Ring = NULL;
}
while ((rrogramEnd == 'R') || (programEnd == 'r'));
return 0;
}
double ran2()
{
int RandomNumber = 0;
RandomNumber = rand();
return RandomNumber;
}