What algorithm did Windows XP use to choose your initial user picture?(devblogs.microsoft.com)
359 points by soheilpro 46 days ago | 177 comments
tl;dr: Windows XP picked your initial user picture using reservoir sampling (k=1) over the Default Pictures directory, seeded by GetTickCount() via RtlRandomEx. This one-pass approach avoids a second file-system enumeration and handles directory changes mid-iteration gracefully. A safety cap stops sampling after 100 files to prevent pathological slowdowns.
HN Discussion:
  • ↑Admiration for Raymond Chen's Windows internals storytelling and longevity
  • ↑Reflection on how modern developers would take a simpler, less elegant approach under time pressure
  • ↑Appreciation for the thoughtful optimization mindset of past developers
  • ↓Questioning whether the single-pass optimization actually matters given filesystem caching
  • •Observation about the conceptual gap between human and computer randomness/selection