modified roll function

use Math.ceil insted of Math.floor
renamed index