lundi 23 février 2015

How to make teams using math.random() in javascript?

I want to make a Javascript function which will take 3 inputs: Starting Number, Ending Number and Number of Teams.


When the user enters the data and hits enter, A HTML table will be displayed which will make teams based on Size Of Team between the Beginning and End numbers.



var Beg; //input for starting number
Var End; // input for ending number
var no_of_teams; //input for number of teams


Math.floor((Math.random() * End) + Beg);


What code should I write to make a HTML table out of the the math.random numbers.


Eg:


User enters


Beg : 43


End : 63


no_of_teams : 5


The Output will be :


Team 1: 54,52,63,43


Team 2: 58,61,49,60


Team 3: 51,52,53,55


Team 4: 49,59,47,44


Team 5: 56,57,45,46





Aucun commentaire:

Enregistrer un commentaire