Improved the Array.rand() method to support an optional argument which specifies the amount of returned elements.