-
Notifications
You must be signed in to change notification settings - Fork 909
Random Pair Generator Script #1711
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
Conversation
Readme file for the Arry matched function
Updated code script
updated read me
|
Here is my first pull request, thank you. |
WillemZeiler
left a comment
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.
Thank you for your contribution. I have added 2 comments to your file that need updating. One is in the description, as the intended usage of this scripts output is not clear from the description. The other is in the code.
| } | ||
|
|
||
|
|
||
| var randomPairs = createRandomPairs(inputs.wheels); |
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.
It seems you expect an input with a "wheels" element, but this is not specified anywhere. Can you in the readme add the expected input format/instructions, or update this line?
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.
oh, yes I need to refactor this pull request.
I need to better explain this function snippet and its use cases.
| --- | ||
|
|
||
| ## How It Works | ||
| 1. **Shuffle the Input Array** |
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.
Wouldn't this be enough to have random pairs? If you shuffle the array then f.e. 0 and 1 can be a random pain. What does the pushing the 2 pairs together in a paired array help do?
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.
This is a Function to take a list of players, in this case was from a Racing Competition Tournament app, where each car is represented by wheels and it would randomize the list of input sys ids and randomize a new order array. Then, from that new list order, it can generate pairs of head-to-head matches according to tournament rules preferences.
PR Description:
This script generates random pairs from an input array. It is designed to take an array of items (e.g., cars, players, names) and shuffle them before grouping them into pairs. If the number of elements is odd, the last element will remain unpaired in a single-element array.
Pull Request Checklist
Overview
Code Quality
Repository Structure Compliance
Core ServiceNow APIs/Server-Side Components/Client-Side Components/Modern Development/Integration/Specialized Areas/Documentation
Restrictions