Ranter
Join devRant
Do all the things like
++ or -- rants, post your own rants, comment on others' rants and build your customized dev avatar
Sign Up
Pipeless API
From the creators of devRant, Pipeless lets you power real-time personalized recommendations and activity feeds using a simple API
Learn More
Comments
-
arnyek5577y@IllSlapU yep, the whole codebase is a garbage, mostly we can't even understand the previous devs' logic - but sometimes we find some even worse snippets, like this.
-
Froot75567y@irene Same here, I don't get it.
As long as the "rand" functions works well enough it should produce a new random string from given characters every time -
arnyek5577y@irene, @Froot well yes, at least it works but it's not too pretty and a bit slow for a solution - problem is, there are too many slow and not pretty code in this project, making it unstable and incredibly slow - and a big pain to fix anything
-
arnyek5577y@irene, @Froot also, as now I see, it could simply fail if called.
strlen returns the string's length, rand's max is inclusive in PHP, so it could reference to an undefined index -
Im not a php pro but isnt there a "str_random" function in the php standard library?
-
C0D4681467y@FetzenNET not in PHP nativity., unless you use OpenSSL’s random_bytes
Possibly, some frameworks have a function to do this which would probably work in a similar way.
Related Rants
Perfect way for generating random string...
undefined
ffs
logic
random
string
why
legacy