In pursuing some of my research as of late, I needed to use Particle Swarm Optimization. All I wanted was some simple code for both Real and Binary PSO - but I couldn't find anything I like! So, I'm providing a file containing both along with the RNG that I used. Please be aware that this code has not been refined. It's clear, but rather ugly.
Particle Swarm Optimization Code