Where do the new 2-blocks spawn in the 2048 game?

It's randomly chosen out of the available cells, as seen in the code here:

if (cells.length) 
{ 
    return cells[Math.floor(Math.random() * cells.length)];
}

(which is used here and eventually here)