Allocation in Windows? 

Does anybody know the way in which a PID is chosen for a new process in Windows? I just ran two instances of Notepad and got PIDs of 4372 and 4880, then when I ran a third it got a PID of 3516. This seems to be a little random. I take it there's some algorithm that chooses them, and it's not just random.