Changed to initialize an Array with an initial size to improve performance
When creating sample from array, fixed bug that would input empty values in the sample.
Added a this for better readability.