Skip to content

Instantly share code, notes, and snippets.

@SuperFromND
Created March 17, 2025 00:51
Show Gist options
  • Save SuperFromND/1c09a17a3d251996a9535f719d23bcf3 to your computer and use it in GitHub Desktop.
Save SuperFromND/1c09a17a3d251996a9535f719d23bcf3 to your computer and use it in GitHub Desktop.
JavaScript: Print ten random Sonic game titles, as if it was a "Top 10" list
var list_of_games = [
"Dr Robotniks Mean Bean Machine",
"Knuckles Chaotix",
"SegaSonic Cosmo Fighter Galaxy Patrol",
"SegaSonic Cotton Candy Scramble",
"SegaSonic Popcorn Shop",
"SegaSonic the Hedgehog",
"Shadow the Hedgehog",
"Sonic & All-Stars Racing Transformed",
"Sonic & Sega All-Stars Racing",
"Sonic 3D Blast",
"Sonic Advance",
"Sonic Advance 2",
"Sonic Advance 3",
"Sonic Adventure",
"Sonic Adventure 2",
"Sonic Athletics",
"Sonic Battle",
"Sonic Blast",
"Sonic Boom: Fire & Ice",
"Sonic Boom: Rise of Lyric",
"Sonic Boom: Shattered Crystal",
"Sonic Chaos",
"Sonic Chronicles: Dark Brotherhood",
"Sonic Colors",
"Sonic Dash",
"Sonic Dream Team",
"Sonic Drift",
"Sonic Drift 2",
"Sonic Eraser",
"Sonic Forces",
"Sonic Free Riders",
"Sonic Frontiers",
"Sonic Generations",
"Sonic Heroes",
"Sonic Labyrinth",
"Sonic Lost World",
"Sonic Mania",
"Sonic Pinball Party",
"Sonic R",
"Sonic Riders",
"Sonic Riders Zero Gravity",
"Sonic Rivals",
"Sonic Rivals 2",
"Sonic Rumble",
"Sonic Runners",
"Sonic Rush",
"Sonic Rush Adventure",
"Sonic Schoolhouse",
"Sonic Shuffle",
"Sonic Spinball",
"Sonic Superstars",
"Sonic Triple Trouble",
"Sonic Unleashed",
"Sonic X (Leapster)",
"Sonic X Shadow Generations",
"Sonic and the Black Knight",
"Sonic and the Secret Rings",
"Sonic the Fighters",
"Sonic the Hedgehog",
"Sonic the Hedgehog (2006)",
"Sonic the Hedgehog 2",
"Sonic the Hedgehog 3 & Knuckles",
"Sonic the Hedgehog 4",
"Sonic the Hedgehog CD",
"Sonic the Hedgehog Pocket Adventure",
"Sonic the Hedgehog's Gameworld",
"Tails Adventure",
"Tails Sky Patrol",
"Tails and the Music Maker",
"Team Sonic Racing",
"The Murder of Sonic the Hedgehog",
"WakuWaku Sonic Patrol Car"
];
for (let i = list_of_games.length - 1; i > 0; i--) {
const j = Math.floor(Math.random() * (i + 1));
const temp = list_of_games[i];
list_of_games[i] = list_of_games[j];
list_of_games[j] = temp;
}
console.log("TOP 10 SONIC GAMES (as decided by random chance)")
for (let j = 0; j < 10; j++) {
console.log((10 - j) + ": " + list_of_games[j])
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment