randomizer

breamy1990 said:
is there a script were i can randomise football teams or what ever by the click of a button or everytime the page is refreshed :confused:

i think people are going to need a lot more of an explanation for what you are trying to do.

is it web based? Programming?

What is this football thing?
 
basically i input a load of football teams off games like fifa 07 and pro evo 6 for example and the script randomizes which ever one is picked

for example i input
rotherham
sheffield
manchester
chelsea
liverpool

i run the script and it picks out sheffield. i run it again and it picks out liverpool and so on so forth so everytime its run it randomizes which one gets picked out

web based or a program doesnt really matter tbh
 
Personally I'd stick every team in an array and use a random number generator to pick which element of the array is choosen. Might want to make the array 2 dimensional so you can lock each element once they have been choosen
 
Spuds said:
Personally I'd stick every team in an array and use a random number generator to pick which element of the array is choosen. Might want to make the array 2 dimensional so you can lock each element once they have been choosen

Nice Idea ill go with this :) cheers m8

how would i go about picking random numbers from say 1-100
 
Last edited:
Depends on what language your using, in java I'd do something like this:

Code:
String[] Teams = {"rotherham", "sheffield", "manchester", "chelsea", "liverpool"}
Random generator = new Random();
int randomTeam = generator.nextInt(Teams.length);
System.out.print("Selected team: " + Teams[randomTeam]);
 
Last edited:
Spuds said:
Depends on what language your using, in java I'd do something like this:

Code:
String[] Teams = {"rotherham", "sheffield", "manchester", "chelsea", "liverpool"}
Random generator = new Random();
int randomTeam = generator.nextInt(Teams.length);
System.out.print("Selected team: " + Teams[randomTeam]);

how do i turn this into a program :confused:
 
here you go. i googled a bit of javascript which will do the job. copy/paste this into notepad and save as test.html

open it in a browser and hit the refresh button. :)

Code:
<html>
<script language="JavaScript">
<!--
team = new Array
team[1]="liverpool"
team[2]="manchester utd"
team[3]="arsenal"
team[4]="middlesborough"
team[5]="chelsea"
team[6]="cheltenham town"
team[7]="watford"
team[8]="reading"
team[9]="barcelona"
random_num = (Math.round((Math.random()*8)+1))
document.write(team[random_num]);
-->
</script>
</body>
</html>
 
marc2003 said:
here you go. i googled a bit of javascript which will do the job. copy/paste this into notepad and save as test.html

open it in a browser and hit the refresh button. :)

Code:
<html>
<script language="JavaScript">
<!--
team = new Array
team[1]="liverpool"
team[2]="manchester utd"
team[3]="arsenal"
team[4]="middlesborough"
team[5]="chelsea"
team[6]="cheltenham town"
team[7]="watford"
team[8]="reading"
team[9]="barcelona"
random_num = (Math.round((Math.random()*8)+1))
document.write(team[random_num]);
-->
</script>
</body>
</html>

Cheers :) now all i need to find is a fifa 07 teams list :o
 
Back
Top Bottom