mirror of
https://github.com/TerryCavanagh/VVVVVV.git
synced 2024-12-22 17:49:43 +01:00
Fix generateBase36 generating more than base 36
Two problems: the fRandom() range was from 0..36, but that's 37 characters, not 36. And the check to sort the lower 26 values into the Latin alphabet used a 'lesser-than-or-equal-to 26' check, even though that checks for the range of values of 0..26, which is 27 letters, even though the alphabet only has 26 letters. So just drop the equals sign from that check.
This commit is contained in:
parent
db76735c07
commit
f3ca4ab2e7
1 changed files with 2 additions and 2 deletions
|
@ -251,8 +251,8 @@ static void generateBase36(char* string, const size_t string_size)
|
|||
for (i = 0; i < string_size - 1; ++i)
|
||||
{
|
||||
/* a-z0-9 */
|
||||
char randchar = fRandom() * 36;
|
||||
if (randchar <= 26)
|
||||
char randchar = fRandom() * 35;
|
||||
if (randchar < 26)
|
||||
{
|
||||
randchar += 'a';
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue