Completely Random License Plate?
#1

pawn Код:
#define     MAX_PASS        8
            new charset[] = "ABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789";
            new newPass[MAX_PASS];
            for(new i = 0; i < MAX_PASS; i++)
            {
              newPass[i] = charset[RandomEx(0, sizeof(charset))]; // 62 = strlen of charset
            }


            format(plate, sizeof(plate), "%s",newPass);
This sometimes doesn't make it 8 characters, sometimes 1, sometimes 2. What's the issue here?
Reply
#2

pawn Код:
new newPass[MAX_PASS + 1];
and

pawn Код:
sizeof(charset)-1
Reply
#3

Thank you.
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)