Javascript Algorithms and Data Structures Challenge: Day 5

Oh, yeah. Another recursion.

Direction: Using recursive algorithm, create an array of 5 elements of integers between 2 to 32, each generated randomly from and unique to the others.

First off, create a random function using Math.random(), which creates random float number from 0 to 1. Max is 32 and min is 2, therefore, the number=2+(0~1)*30 which gives you a min of 2 and max of 32.

function randomNumber(){
return 2+Math.ceil(Math.random()*30);
}