-
Notifications
You must be signed in to change notification settings - Fork 65
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Randomizing order of "where did you hear about us" and "industry" options #3177
Conversation
I would use |
Pull Request Test Coverage Report for Build 8421094700Details
💛 - Coveralls |
Adjustment applied. |
It needs to be the same on mobile and web, and definitely the codes sent to backend must match (cc @tomasMizera ) |
var j = Math.floor( Math.random() * ( i + 1 ) ); | ||
var temp = items[ i ]; | ||
items[ i ] = items[ j ]; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I can see it is motivated by this algo which if fine, but I struggle to understand how come this won't lead to exceptions.
If you consider this scenario:
array length = 8
for loop ( i == 7 )
j = Math.floor( 0.999 * ( 7 + 1 ) ) // j == 8 here
..
items [j] // <<-- here you go outside of bounds of the input array
For that reason, I would prefer a simpler and more readable version: https://stackoverflow.com/a/46545530/7875594 :)
The keys should be the same on the server and here. It was an agreement between @MarcelGeo and @uclaros. Texts should be the same as here https://docs.google.com/spreadsheets/d/1VSrdlT0JdnI4BnMlzVeUaaI9AICFnwVk0m9Rr-MKJZ8/edit#gid=0 - feel free to suggest changes there first |
1b20b87
to
840999e
Compare
Obs: Option "other" always last.