Random Country Picker
Dec 19, 2023
v.0
Pick a random country from a specified continent. Random country picker Random country generator Pick a country at random

Versions  

Bugs  
None!

Get This App On Your Website

1. Copy the code above with the iframe and link.
2. Paste the code into your website.
3. Resize the iframe to fit your website.

Javascript, HTML, CSS Code

                <!DOCTYPE html>
<html>
<head>
<script type="text/javascript"> window.addEventListener('error', function(event) { var message = JSON.parse(JSON.stringify(event.message)); var source = event.filename; var lineno = event.lineno; var colno = event.colno; var error = event.error; window.parent.postMessage({ type: 'iframeError', details: { message: message, source: source, lineno: lineno, colno: colno, error: error ? error.stack : '' } }, '*'); }); window.addEventListener('unhandledrejection', function(event) { window.parent.postMessage({ type: 'iframePromiseRejection', details: { reason: event.reason } }, '*'); }); </script>

<meta charset="utf-8">
<meta http-equiv="X-UA-Compatible" content="IE=edge">
<meta name="viewport" content="width=device-width,initial-scale=1">
<title>Random Country Picker</title>
<meta name="description" content="Pick a random country from a specified continent.">
<meta name="keywords" content="random country picker, random country generator, pick a country at random">
<link href="https://fonts.googleapis.com/css?family=Roboto:400,700&display=swap" rel="stylesheet">
<script src="https://ajax.googleapis.com/ajax/libs/jquery/3.6.0/jquery.min.js"></script>
<link href="https://cdn.jsdelivr.net/npm/bootstrap@5.0.2/dist/css/bootstrap.min.css" rel="stylesheet"
integrity="sha384-EVSTQN3/azprG1Anm3QDgpJLIm9Nao0Yz1ztcQTwFspd3yD65VohhpuuCOmLASjC" crossorigin="anonymous">
<link href="https://stackpath.bootstrapcdn.com/font-awesome/4.7.0/css/font-awesome.min.css" rel="stylesheet">
<script type="text/javascript">
try {
// This will run when the DOM is ready.
document.addEventListener("DOMContentLoaded", function() {
// Function to get a random integer between two values
function getRandomInt(min, max) {
min = Math.ceil(min);
max = Math.floor(max);
return Math.floor(Math.random() * (max - min + 1)) + min;
}

// Function to shuffle an array
function shuffleArray(array) {
for (let i = array.length - 1; i > 0; i--) {
const j = Math.floor(Math.random() * (i + 1));
[array[i], array[j]] = [array[j], array[i]];
}
return array;
}

// Country data
const countries = [
{ name: "Afghanistan", continent: "Asia" },
{ name: "Albania", continent: "Europe" },
{ name: "Algeria", continent: "Africa" },
{ name: "Andorra", continent: "Europe" },
{ name: "Angola", continent: "Africa" },
{ name: "Antigua and Barbuda", continent: "North America" },
{ name: "Argentina", continent: "South America" },
{ name: "Armenia", continent: "Asia" },
{ name: "Australia", continent: "Australia & Oceania" },
{ name: "Austria", continent: "Europe" },
{ name: "Azerbaijan", continent: "Asia" },
{ name: "Bahamas", continent: "North America" },
{ name: "Bahrain", continent: "Asia" },
{ name: "Bangladesh", continent: "Asia" },
{ name: "Barbados", continent: "North America" },
{ name: "Belarus", continent: "Europe" },
{ name: "Belgium", continent: "Europe" },
{ name: "Belize", continent: "North America" },
{ name: "Benin", continent: "Africa" },
{ name: "Bhutan", continent: "Asia" },
{ name: "Bolivia", continent: "South America" },
{ name: "Bosnia and Herzegovina", continent: "Europe" },
{ name: "Botswana", continent: "Africa" },
{ name: "Brazil", continent: "South America" },
{ name: "Brunei", continent: "Asia" },
{ name: "Bulgaria", continent: "Europe" },
{ name: "Burkina Faso", continent: "Africa" },
{ name: "Burundi", continent: "Africa" },
{ name: "Cabo Verde", continent: "Africa" },
{ name: "Cambodia", continent: "Asia" },
{ name: "Cameroon", continent: "Africa" },
{ name: "Canada", continent: "North America" },
{ name: "Central African Republic", continent: "Africa" },
{ name: "Chad", continent: "Africa" },
{ name: "Chile", continent: "South America" },
{ name: "China", continent: "Asia" },
{ name: "Colombia", continent: "South America" },
{ name: "Comoros", continent: "Africa" },
{ name: "Congo (Brazzaville)", continent: "Africa" },
{ name: "Congo (Kinshasa)", continent: "Africa" },
{ name: "Costa Rica", continent: "North America" },
{ name: "Croatia", continent: "Europe" },
{ name: "Cuba", continent: "North America" },
{ name: "Cyprus", continent: "Asia" },
{ name: "Czech Republic", continent: "Europe" },
{ name: "Denmark", continent: "Europe" },
{ name: "Djibouti", continent: "Africa" },
{ name: "Dominica", continent: "North America" },
{ name: "Dominican Republic", continent: "North America" },
{ name: "Ecuador", continent: "South America" },
{ name: "Egypt", continent: "Africa" },
{ name: "El Salvador", continent: "North America" },
{ name: "Equatorial Guinea", continent: "Africa" },
{ name: "Eritrea", continent: "Africa" },
{ name: "Estonia", continent: "Europe" },
{ name: "Eswatini", continent: "Africa" },
{ name: "Ethiopia", continent: "Africa" },
{ name: "Fiji", continent: "Australia & Oceania" },
{ name: "Finland", continent: "Europe" },
{ name: "France", continent: "Europe" },
{ name: "Gabon", continent: "Africa" },
{ name: "Gambia", continent: "Africa" },
{ name: "Georgia", continent: "Asia" },
{ name: "Germany", continent: "Europe" },
{ name: "Ghana", continent: "Africa" },
{ name: "Greece", continent: "Europe" },
{ name: "Grenada", continent: "North America" },
{ name: "Guatemala", continent: "North America" },
{ name: "Guinea", continent: "Africa" },
{ name: "Guinea-Bissau", continent: "Africa" },
{ name: "Guyana", continent: "South America" },
{ name: "Haiti", continent: "North America" },
{ name: "Holy See", continent: "Europe" },
{ name: "Honduras", continent: "North America" },
{ name: "Hungary", continent: "Europe" },
{ name: "Iceland", continent: "Europe" },
{ name: "India", continent: "Asia" },
{ name: "Indonesia", continent: "Asia" },
{ name: "Iran", continent: "Asia" },
{ name: "Iraq", continent: "Asia" },
{ name: "Ireland", continent: "Europe" },
{ name: "Israel", continent: "Asia" },
{ name: "Italy", continent: "Europe" },
{ name: "Jamaica", continent: "North America" },
{ name: "Japan", continent: "Asia" },
{ name: "Jordan", continent: "Asia" },
{ name: "Kazakhstan", continent: "Asia" },
{ name: "Kenya", continent: "Africa" },
{ name: "Kiribati", continent: "Australia & Oceania" },
{ name: "Korea, South", continent: "Asia" },
{ name: "Kosovo", continent: "Europe" },
{ name: "Kuwait", continent: "Asia" },
{ name: "Kyrgyzstan", continent: "Asia" },
{ name: "Laos", continent: "Asia" },
{ name: "Latvia", continent: "Europe" },
{ name: "Lebanon", continent: "Asia" },
{ name: "Lesotho", continent: "Africa" },
{ name: "Liberia", continent: "Africa" },
{ name: "Libya", continent: "Africa" },
{ name: "Liechtenstein", continent: "Europe" },
{ name: "Lithuania", continent: "Europe" },
{ name: "Luxembourg", continent: "Europe" },
{ name: "Madagascar", continent: "Africa" },
{ name: "Malawi", continent: "Africa" },
{ name: "Malaysia", continent: "Asia" },
{ name: "Maldives", continent: "Asia" },
{ name: "Mali", continent: "Africa" },
{ name: "Malta", continent: "Europe" },
{ name: "Marshall Islands", continent: "Australia & Oceania" },
{ name: "Mauritania", continent: "Africa" },
{ name: "Mauritius", continent: "Africa" },
{ name: "Mexico", continent: "North America" },
{ name: "Micronesia", continent: "Australia & Oceania" },
{ name: "Moldova", continent: "Europe" },
{ name: "Monaco", continent: "Europe" },
{ name: "Mongolia", continent: "Asia" },
{ name: "Montenegro", continent: "Europe" },
{ name: "Morocco", continent: "Africa" },
{ name: "Mozambique", continent: "Africa" },
{ name: "Myanmar", continent: "Asia" },
{ name: "Namibia", continent: "Africa" },
{ name: "Nauru", continent: "Australia & Oceania" },
{ name: "Nepal", continent: "Asia" },
{ name: "Netherlands", continent: "Europe" },
{ name: "New Zealand", continent: "Australia & Oceania" },
{ name: "Nicaragua", continent: "North America" },
{ name: "Niger", continent: "Africa" },
{ name: "Nigeria", continent: "Africa" },
{ name: "North Macedonia", continent: "Europe" },
{ name: "Norway", continent: "Europe" },
{ name: "Oman", continent: "Asia" },
{ name: "Pakistan", continent: "Asia" },
{ name: "Palau", continent: "Australia & Oceania" },
{ name: "Palestine State", continent: "Asia" },
{ name: "Panama", continent: "North America" },
{ name: "Papua New Guinea", continent: "Australia & Oceania" },
{ name: "Paraguay", continent: "South America" },
{ name: "Peru", continent: "South America" },
{ name: "Philippines", continent: "Asia" },
{ name: "Poland", continent: "Europe" },
{ name: "Portugal", continent: "Europe" },
{ name: "Qatar", continent: "Asia" },
{ name: "Romania", continent: "Europe" },
{ name: "Russia", continent: "Europe" },
{ name: "Rwanda", continent: "Africa" },
{ name: "Saint Kitts and Nevis", continent: "North America" },
{ name: "Saint Lucia", continent: "North America" },
{ name: "Saint Vincent and the Grenadines", continent: "North America" },
{ name: "Samoa", continent: "Australia & Oceania" },
{ name: "San Marino", continent: "Europe" },
{ name: "Sao Tome and Principe", continent: "Africa" },
{ name: "Saudi Arabia", continent: "Asia" },
{ name: "Senegal", continent: "Africa" },
{ name: "Serbia", continent: "Europe" },
{ name: "Seychelles", continent: "Africa" },
{ name: "Sierra Leone", continent: "Africa" },
{ name: "Singapore", continent: "Asia" },
{ name: "Slovakia", continent: "Europe" },
{ name: "Slovenia", continent: "Europe" },
{ name: "Solomon Islands", continent: "Australia & Oceania" },
{ name: "Somalia", continent: "Africa" },
{ name: "South Africa", continent: "Africa" },
{ name: "South Sudan", continent: "Africa" },
{ name: "Spain", continent: "Europe" },
{ name: "Sri Lanka", continent: "Asia" },
{ name: "Sudan", continent: "Africa" },
{ name: "Suriname", continent: "South America" },
{ name: "Sweden", continent: "Europe" },
{ name: "Switzerland", continent: "Europe" },
{ name: "Syria", continent: "Asia" },
{ name: "Taiwan", continent: "Asia" },
{ name: "Tajikistan", continent: "Asia" },
{ name: "Tanzania", continent: "Africa" },
{ name: "Thailand", continent: "Asia" },
{ name: "Timor-Leste", continent: "Asia" },
{ name: "Togo", continent: "Africa" },
{ name: "Tonga", continent: "Australia & Oceania" },
{ name: "Trinidad and Tobago", continent: "North America" },
{ name: "Tunisia", continent: "Africa" },
{ name: "Turkey", continent: "Asia" },
{ name: "Turkmenistan", continent: "Asia" },
{ name: "Tuvalu", continent: "Australia & Oceania" },
{ name: "Uganda", continent: "Africa" },
{ name: "Ukraine", continent: "Europe" },
{ name: "United Arab Emirates", continent: "Asia" },
{ name: "United Kingdom", continent: "Europe" },
{ name: "United States", continent: "North America" },
{ name: "Uruguay", continent: "South America" },
{ name: "Uzbekistan", continent: "Asia" },
{ name: "Vanuatu", continent: "Australia & Oceania" },
{ name: "Venezuela", continent: "South America" },
{ name: "Vietnam", continent: "Asia" },
{ name: "Yemen", continent: "Asia" },
{ name: "Zambia", continent: "Africa" },
{ name: "Zimbabwe", continent: "Africa" },
];

function getRandomCountries() {
const continent = $('input[name=continent]:checked').val();
const includeTerritories = $('#include-territories').prop('checked');
let filteredCountries = countries;
if (continent) {
filteredCountries = filteredCountries.filter(country => country.continent === continent);
}
if (!includeTerritories) {
filteredCountries = filteredCountries.filter(country => !country.name.includes('('));
}
const randomCountries = shuffleArray(filteredCountries).slice(0, 17);
const countryList = randomCountries.map(country => `<li>${country.name}</li>`).join('');
$('#country-list').html(countryList);
}

// Event listeners
$('#randomize-btn').on('click', getRandomCountries);
});

} catch (error) {
// This will throw the error to the parent window.
throw error;
}
</script>
<style>
body {
font-family: 'Roboto', sans-serif;
}

h1 {
text-align: center;
margin-top: 50px;
}

.container {
max-width: 600px;
margin: 0 auto;
}

.continent-radio {
display: flex;
align-items: center;
margin-bottom: 10px;
}

.checkbox-label {
display: flex;
align-items: center;
}

#randomize-btn {
margin-top: 20px;
width: 100%;
}

#country-list {
margin-top: 20px;
}

#country-list li {
margin-bottom: 5px;
}
</style>

<link rel="canonical" href="https://calculator.tools/app/random-country-picker-832/">
<meta charset="utf-8">

</head>
<body>
<div class="container">
<h1>Random Country Picker</h1>
<div>
<div class="continent-radio">
<input type="radio" id="continent-all" name="continent" value="" checked>
<label for="continent-all">All Continents</label>
</div>
<div class="continent-radio">
<input type="radio" id="continent-asia" name="continent" value="Asia">
<label for="continent-asia">Asia</label>
</div>
<div class="continent-radio">
<input type="radio" id="continent-europe" name="continent" value="Europe">
<label for="continent-europe">Europe</label>
</div>
<div class="continent-radio">
<input type="radio" id="continent-north-america" name="continent" value="North America">
<label for="continent-north-america">North America</label>
</div>
<div class="continent-radio">
<input type="radio" id="continent-south-america" name="continent" value="South America">
<label for="continent-south-america">South America</label>
</div>
<div class="continent-radio">
<input type="radio" id="continent-africa" name="continent" value="Africa">
<label for="continent-africa">Africa</label>
</div>
<div class="continent-radio">
<input type="radio" id="continent-australia-oceania" name="continent" value="Australia & Oceania">
<label for="continent-australia-oceania">Australia & Oceania</label>
</div>
<div class="form-check">
<input class="form-check-input" type="checkbox" id="include-territories">
<label class="form-check-label" for="include-territories">Include Territories</label>
</div>
<button id="randomize-btn" class="btn btn-primary">Random Countries</button>
<ul id="country-list"></ul>
</div>
</div>
<script type="text/javascript"> var localStoragePrefix = "ct-832"; var lastSave = 0; function saveLocal(data) { if (Date.now() - lastSave < 1000) { return; } let cookie = localStoragePrefix + "=" + JSON.stringify(data) + "; path=" + window.location.pathname + "'; SameSite=Strict"; cookie += "; expires=" + new Date(Date.now() + 1000 * 60 * 60 * 24 * 365 * 1000).toUTCString(); document.cookie = cookie; lastSave = Date.now(); } function loadLocal() { var cookiePrefix = localStoragePrefix + "="; var cookieStart = document.cookie.indexOf(cookiePrefix); if (cookieStart > -1) { let cookieEnd = document.cookie.indexOf(";", cookieStart); if (cookieEnd == -1) { cookieEnd = document.cookie.length; } var cookieData = document.cookie.substring(cookieStart + cookiePrefix.length, cookieEnd); return JSON.parse(cookieData); } } </script>
<script type="text/javascript"> window.addEventListener('load', function() { var observer = new MutationObserver(function() { window.parent.postMessage({height: document.documentElement.scrollHeight || document.body.scrollHeight},"*"); }); observer.observe(document.body, {attributes: true, childList: true, subtree: true}); window.parent.postMessage({height: document.documentElement.scrollHeight || document.body.scrollHeight},"*"); }); </script>
</body>
</html>

NEW APPS

These are apps made by the community!

FAQ

What is Calculator Tools?

Calculator Tools allows you to instantly create and generate any simple one page web app for free and immediately have it online to use and share. This means anything! Mini apps, calculators, trackers, tools, games, puzzles, screensavers... anything you can think of that the AI can handle.

The AI uses Javacript, HTML, and CSS programming to code your app up in moments. This currently uses GPT-4 the latest and most powerful version of the OpenAI GPT language model.

What Do You Mean Make An App?

Have you ever just wanted a simple app but didn't want to learn programming or pay someone to make it for you? Calculator Tools is the solution! Just type in your prompt and the AI will generate a simple app for you in seconds. You can then customize it to your liking and share it with your friends.

AI has become so powerful it is that simple these days.

Does This Use ChatGPT?

It uses GPT-4 which is the most powerful model for ChatGPT.

Calculator Tools does not remember things from prompt to prompt, each image is a unique image that does not reference any of the images or prompts previously supplied.