46
u/javarouleur Sep 20 '19
Meh... actual validation is a different user story... this is just mid-sprint code... right? Right?
But comment inaccurate and missing `@param`. PR declined.
2
11
5
5
u/andiconda Sep 20 '19
Remind me of some x509 cert authorization code I wrote for a client. It just returned true no matter what. It was actually low risk and the call for encryption was political.
But they asked "hey when you get <other vendor>'s certificate, what do you do?"
And I say, "I authorize it"
Technically correct, the best kind of correct.
1
1
1
1
u/AleAndrade Sep 20 '19
I mean, I can not be implemented, but can't be changed to an exception for Reasons
1
-1
0
Sep 20 '19
[deleted]
1
u/c3534l Sep 21 '19
7
u/Teknikal_Domain Sep 21 '19 edited Sep 21 '19
That one has a reason though.
For example, playing back demo files or keeping things consistent client/server.
You have randomness within the game, but each instance is the same, in effect it's a RNG with a preset, constant seed.
From the wiki page:
Each call to the function P_Random advances the index by one (wrapping around to zero after 255) and returns the table entry at that index.
There is another function, M_Random, that is identical except that it uses its own independent index.
P_Randomis used in play simulation situations, such as calculating hit damage.M_Randomis used otherwise.The reason for the existence of two individual indexes is to maintain multiplayer synchronisation: for example,
M_Randomis used to apply a random pitch variation to sounds. As two players may not hear the same sound effect (they may be in different parts of the level), using a single index would cause the game to become desynchronised. To use a model-view-controller analogy,P_Randomis used for random number generation at the 'model', whileM_Randomis used for random number generation at the 'view'.The function M_ClearRandom resets both functions' indexes to zero. It is called during initialization of each new level so that demos will be the same each time they are played, and so that multiplayer games are synchronised.
Although the table is 256 bytes long, it does not contain all of the numbers between 0 and 255 inclusive. For example, 0 appears twice and 1 does not appear at all; 145 appears five times, more than any other number. Thus the values are not uniformly distributed, but in fact they are nearly so. The mean value is 128.852, whereas it would be 127.500 if all values were equally likely. All of this suggests that the table was generated using a conventional pseudorandom number generator of reasonable quality.
203
u/somehowyellow Sep 20 '19
Looks like a placeholder for future functionality