added support for rand and exact sizing

original sizing has to be fixed, using only one document.write