Random number
Random number between -13 and +13, skipping -3 to +3
by adamh
JavaScript
var random;
// Get a random number between 1-10 and add 3, to get one between 4-13:
random = Math.ceil(Math.random() * 10) + 3;
// Generate a random between 0-1. If it's 0, make the number negative:
random = (Math.floor(Math.random() * 2) == 0) ? 0 - random : random;
alert(random);