Live data from Hacker News

What algorithm did Windows XP use to choose your initial user picture?

devblogs.microsoft.com

121–130 of 159 posts

Re: What algorithm did Windows XP use to choose your initial user picture?

#121
post #82

Earlier quoted context omitted.

Thank you for writing this out, I didn't quite get what was going on at first. But then, to formalize the recursion from your example: let's assume we're at item n in the iterator, and at that point we've selected a winner from the previous n-1 items with equal probability, i.e. each item had a 1/(n-1) chance of being selected. The probability that item n will override it is 1/n. The probability that the old winner w…

An alternative wording for the same idea: If you are at picture 1, you have 100% chance of selecting it as the current winner. If you are at picture 2, you have 1/2 chance of selecting it as the current winner, or 1/2 chance of keeping the previous fairly selected winner. At picture 3, 1/3 chance of picking it, or 2/3 chance of retaining the previous fairly-selected winner. There are two of them, so 1/3 chance of eac…

This feels very analogous to the three doors puzzle.

Re: What algorithm did Windows XP use to choose your initial user picture?

#122
post #77

Earlier quoted context omitted.

Didn't that design appear first in 3.51?

Only if you install the Shell Technology Preview from Microsoft. NT 3.51 came with the classic Win 3.x look and feel as well as Program Manager.

Yea, it was 4.0, oops

Re: What algorithm did Windows XP use to choose your initial user picture?

#123
post #85

Honestly, I don't understand Microsoft. These guys solve the most mundane problems with most elegant solutions and with sound edge-case handling scenarios, then they destroy all the effort with subpar programming where it matters and with user hostile behavior where they can't botch it.

They simply find some problems more interesting to solve than others. Just like the rest of us.

(Perhaps it shows that Apple engineers are pushed to grind at the boring problems more; therefore maybe it is better to work at Microsoft)

Re: What algorithm did Windows XP use to choose your initial user picture?

#124
post #73
post #49

Earlier quoted context omitted.

Didn't know that NT5 source is available for the public. Why Microsoft does not ban/delete it on GitHub?

It'll pop up elsewhere so might as well keep it online on their servers. And it's an old version of the OS anyway. If it were the Windows 11 source, it'd get nuked immediately

> And it's an old version of the OS anyway.

Most modern Windows code was written in 1995. Don't assume for one moment that it isn't in production Win11 today.

Re: What algorithm did Windows XP use to choose your initial user picture?

#125
post #46

>Raymond has been involved in the evolution of Windows for more than 30 years. He occasionally appears on the Windows Dev Docs Twitter account to tell stories which convey no useful information.

A true Microsoft drone to the end.

Re: What algorithm did Windows XP use to choose your initial user picture?

#126
post #114

Earlier quoted context omitted.

The problem isn’t counting the files (the algorithm in the article also counts the files), but that if you determine that you want to use the i th file only after counting all files, you have to iterate over the whole directory again (or over expected half of it) to find that file.

The mechanism is interesting, but I'm not fully understanding the importance. We say it was done this way because a user would appreciate the speedup. The difference is one traversal versus expected one and one-half traversals. How slow was this traversal at the time for this difference to be significant?

It will depend on details like file system fragmentation (Windows XP could run on FAT32), but it could conceivably make a perceptible difference on a slow HDD when there are many pictures in the directory. You also have to check more error cases, for when the second iteration fails for some reason. The mindset was probably "why complicate the code with multiple iterations and make it less efficient?" when the efficient solution is straightforward and arguably simpler.

Re: What algorithm did Windows XP use to choose your initial user picture?

#128

Honestly, I don't understand Microsoft. These guys solve the most mundane problems with most elegant solutions and with sound edge-case handling scenarios, then they destroy all the effort with subpar programming where it matters and with user hostile behavior where they can't botch it.

That's simple. The Windows Kernel is a collection of mostly elegant solutions, with a strong peppering of backwards-compatibility cruft, all the way from NT3 to Windows 11. The Windows userland received a lot of effort until about Windows XP, and since then is a collection of subpar programming, half-finished projects and user-hostile patterns (with some notable exceptions) Different teams with different goals and di…

> Different teams with different goals and different management

Not to mention the stack ranking policies that caused engineers to sabotage other people's work and avoid collaboration in order to keep themselves high on the stack in order to avoid being fired.

Re: What algorithm did Windows XP use to choose your initial user picture?

#129
post #27

Man, every post from Raymond Chen regarding Windows internals is like a little Xmas. I wonder whether he has to ask someone for permission before publishing this knowledge, though.

I also wonder what his thoughts on “modern Windows” are

It's not as if he's stopped working on Windows since 2000.

Re: What algorithm did Windows XP use to choose your initial user picture?

#130
post #111

This is a fun example of the cognitive switch you have to employ when first starting to program a computer. It's extremely easy for a human to pick at random one thing from a pile of things: you reach out your hand and grab it, maybe swirling them around on the table first to shuffle the order. For a computer, there's no direct analogy to that. They just can't do it. And the human process is nothing even slightly lik…

I think this article highlights more the importance of understanding system limits in the 1990s versus today. No-one would care to much today if the code review for this feature had “files.count()” or whatever in it, but in the mid 90s that would have been a huge performance red flag because a user would literally hear their hard drive clicking away and see the blinkenlights.

That's why now we need gigabytes of ram to do the same thing we managed in 128Mb back then. I mean sure, there's an AI chatbot in your PDF viewer and ads in your start menu, but the functionality of many daily things is still the same.
Post reply on HN