Generate and sort array of n number without using HTML5 web workers