Cases aren't allocated by any random process - once you're known as the guy who does tech things, you're likely to grab those cases.
Northern district of California is a proper venue based on the civil rules (defendant's HQ almost always is), so the plaintiff files there. After that, it’s randomly assigned to one of the 14 judges, so there was roughly a 0.5% chance of Alsup getting both.
is just because he works in the area where tech companies have their headquarters?
Yes, it defines the venue for civil cases.
Also Judges can request cases, and it might be that since he understands what the tech mumbo jumbo is, he got the case.
Really? I didn't know federal judges can request cases. Is that specifically a N.D. Cal. thing? I always thought cases were randomly assigned to a judge in the relevant district.