Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Mike Lewis on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Random Number Generator

Status
Not open for further replies.

jodders

Programmer
Nov 12, 2003
13
0
0
GB
Im trying to make a random number generator for 8 shapes,and im have a little trouble at da moment with my coding.

so far my function looks like this:


public void random(){
for(int i =1;i <8; i++){
int n1 = (int) (Math.Random() * number);
int n2 = (int) (Math.Random() * number);
Shape temp = stack[n1];
stack[n1] = stack[n2];
stack[n2] = temp;
}
}
}


it wont seem to compile,so do i have to declare my n1 variables ? and also stack? IF i want to call the random function,how do i call it?
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top