Skip welcome & menu and move to editor
Welcome to JS Bin
Load cached copy from
 
<!DOCTYPE html>
<html>
<head>
  <meta charset="utf-8">
  <title>JS Bin</title>
</head>
<body>
</body>
</html>
 
// noprotect
debugger;
var ground = generateGround(10, 10);
function generateGround(height, width)
{
  var ground = [];
  for (var y = 0 ; y < height; y++) 
  {
    ground[y] = [];
    for (var x = 0; x < width; x++) 
    {
        ground[y][x] = tile();
    }  
  }
  return ground;
  
  function tile()
  {
    return (Math.random() * 5 | 0) + 6;
  }
}
 
Output

You can jump to the latest bin by adding /latest to your URL

Dismiss x
public
Bin info
anonymouspro
0viewers