Windows XP assigned a default user profile picture by randomly selecting from images stored in the system's Default Pictures folder. The selection process used a one-pass random selection algorithm, seeded by the current system uptime value from GetTickCount(). This approach, implemented via the RtlRandomEx function, avoided the inefficiencies of a two-pass method that would first count all files and then pick one by index.
The one-pass algorithm is a simplified form of reservoir sampling, designed to select one item from an iterator without knowing the total number of items in advance. It works by iterating through each file and deciding probabilistically whether to replace the current selection, ensuring each file has an equal chance of being chosen.
This method reduces file system calls, which are performance bottlenecks, and also handles cases where the number of files might change during execution. To prevent excessive processing, the algorithm caps the number of files it samples at 100, avoiding issues if the directory contains an unusually large number of images.
This design choice reflects a practical balance between randomness, efficiency, and robustness in Windows XP's user experience setup.