Fix random time in tap-new - #23432
Merged
Merged
Conversation
Contributor
There was a problem hiding this comment.
Pull request overview
This PR fixes the random schedule time generation in brew tap-new so the generated autobump workflow can select the full 24-hour day (including hour 23) and all 5-minute blocks (including minute 55), avoiding an off-by-one limitation in Random.rand(max).
Changes:
- Adjust random hour generation from
Random.rand(23)toRandom.rand(24)so23is reachable. - Adjust random 5-minute block generation from
Random.rand(11) * 5toRandom.rand(12) * 5so55is reachable.
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
MikeMcQuaid
approved these changes
Aug 4, 2026
nandahkrishna
approved these changes
Aug 4, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
brewcommands to reproduce the bug?brew lgtm(style, typechecking and tests) locally?As @nandahkrishna pointed out, Random.rand does not include the max provided. So 23 can only give 22 as a max return. Upping it by one allows it to select the full day.