So we've all heard of LIFO, FIFO, FILO, and LILO. (Last in, first out, etc.) What about LIRO? Last in, random out. Is that a common collection management pattern?
This occurs more commonly in nature, right? For example: water-homeostasis. If you drink too much water, the body's kidneys finds a way to get rid of the excess. Except, it's not the last water molecule that gets pushed out. Or the first. Whatever water molecule happens to be passing through the kidneys at the time is outputted.
I've been thinking about how to articulate this better in context of computing. Perhaps the analogy is irrelevant. In the case of water-homeostasis, all molecules are exactly the same (i.e., the values are the same even of the referenced object is not).
Update:
Upon further discussion, a colleague recommended that "Any In, Random Out" would be more pertinent.
In some of the responses, it was suggested that the input has no effect on the output. I don't think this is entirely true. Consider the following collection:
[3, 7, 3, 7, 7]
Even if the ordinality is random, the output is not. For example, the collection could not yield 5, 8, or 3,000,000. The input not only affects the range of eligible output values, it could (as in my analogy) trigger the output.
Aucun commentaire:
Enregistrer un commentaire