Skip to content

Instantly share code, notes, and snippets.

@pmacMaps
Created November 13, 2020 13:30
Show Gist options
  • Save pmacMaps/e22abd08864e4ee46536277c3c52c766 to your computer and use it in GitHub Desktop.
Save pmacMaps/e22abd08864e4ee46536277c3c52c766 to your computer and use it in GitHub Desktop.
Function to randomize order of Central PA GIS Day exhibitors
'use strict';
let shuffleArray = array => {
let m = array.length, t, i;
// While there remain elements to shuffle
while (m) {
// Pick a remaining element…
i = Math.floor(Math.random() * m--);
// And swap it with the current element.
t = array[m];
array[m] = array[i];
array[i] = t;
}
return array;
}
// exhibitors by alphabetical order
const exhibitorArray = [
'Central Pennsylvania National Weather Service',
'Data Axle',
'EagleView Technologies',
'Esri',
'GeoDecisions',
'GISinc',
'Harrisburg University of Science & Technology',
'JMT Technology Group',
'Larson Design Group',
'McKim & Creed, Inc.',
'PA Office of Administration - Conservation & Environment Delivery Center',
'PA Office of Administration - Office for Information Technology',
'Pennsylvania Spatial Data Access',
'PHMC-State Historic Preservation Office',
'Shippensburg University Center for Land Use and Sustainability',
'The Nature Conservancy'
]
// randomized order of exhibitors
const randomizedExhibitorArray = shuffleArray(exhibitorArray);
// list out items
console.log(randomizedExhibitorArray);
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment