5 ms·
np.random.choice(52, 52, False) + 1
by anothernewdude 4y ago
np.random.choice(52, 52, False) + 1
- CoastalCoder 4y agoI'd start with, "What do you mean by 'random'?"
- eastbound 4y agoObligatory response, Dilbert’s “9… 9… 9…” number generator, “the problem with randomness, is that you can never be sure…” https://www.dilbert.com/strip/2001-10-25 https://www.dilbert.com/strip/2001-10-25
- mjochim 4y agoIf we are talking obligatory responses, don't forget this one: https://xkcd.com/221/ https://xkcd.com/221/
- bornfreddy 4y agoYup. Seemingly trivial questions can reveal a lot about the candidate.
- znpy 4y agoIndeed. I have been routinely questioned about what happens from when you type www.somesite.com and when the webpage is displayed when interviewing over the years and realised that nowadays I could fill 2 whole hours talking about all the stuff that actually happens (and many times I would have to say “but about this specific thing I’m not very knowledgeable about)… whereas at the start of my career i would have probably spoken for like 15 seconds and felt smart about answering “such an easy question”.
- deleted 4y ago[deleted]
- klyrs 4y agoMine would be "what do you mean by 'first number'." If they answer with one-indexing, walk out of the interview.
- buzzdenver 4y agoWhat is the catch here? In multi dimensional and infinite cases it can be a little tricky, but in this one is there more to it than "all permutations should have the same probability"?
- CoastalCoder 4y agoI'm not an expert, but here are a few of the things that come to mind for me: - One conception of random is subjective: the pattern must not be predictable by a particular person/entity. E.g., the Fibonacci sequence may seem random to a person with IQ 3, but not IQ 1000. - I think related to that is the concept of cryptographically random: [0] - Random numbers can have different statistical distributions. You referred to uniform randomness, but depending on the application, that's not necessarily what you want. E.g., [1] Especially for statistical / Monte Carlo modeling. - Depending on just how random you need something to be and to whom, you may or may not need specialized computing hardware. [2] - Sometimes people kinda want random, but they also want reproducibility if necessary. Think randomly generated unit test input, or randomly generated game levels. For those applications, it's helpful to know that most software uses pseudo- -random number generators (PRNG's). If you can remember the specific number used to seed the PRNG stream, you may be able to deterministically re-execute the code at will. Alternatively, if you want to (nearly) guarantee that subsequent runs of the program aren't the same, you'll want to somehow ensure that a different seed number is used for the different program runs. So if anything about the job opening depends on this kind of stuff, IMHO it's a great interview question. [0] https://crypto.stackexchange.com/questions/39186/what-does-it-mean-for-a-random-number-generator-to-be-cryptographically-secure https://crypto.stackexchange.com/questions/39186/what-does-i... [1] https://stackoverflow.com/questions/37828955/what-is-the-difference-between-uniform-and-gaussian-random-timer https://stackoverflow.com/questions/37828955/what-is-the-dif... [2] https://en.wikipedia.org/wiki/Entropy_(computing) https://en.wikipedia.org/wiki/Entropy_(computing)