Set up prototype shape functions; adjusted random.js to use it.