Skip to content
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

refactor: rewrite RandomIterableAggregate to avoid recursion #53

Merged
merged 1 commit into from
Feb 18, 2024

Conversation

drupol
Copy link
Contributor

@drupol drupol commented Jan 27, 2024

This PR:

  • Remove recursion in RandomIterableAggregate, potentially avoiding memory issues.
  • I really like this new implementation :D

Related to PR: loophp/collection#332

Copy link

what-the-diff bot commented Jan 27, 2024

PR Summary

  • Introduction of RandomIterableAggregate Class
    We have created a new class called RandomIterableAggregate. This class starts with any collection of items ('iterable') and a 'seed' value. The class is responsible for generating a randomized sequence of elements from the provided collection, ensuring the overall order of items is unpredictable. The process to develop this class has been streamlined through the implementation of a CachingIteratorAggregate and a ShuffleIteratorAggregate.

  • Addition of ShuffleIteratorAggregate Class
    Another new class, ShuffleIteratorAggregate, has also been introduced. This class can produce sequences of shuffled numbers from 0 up to a certain maximum limit (minus one). To achieve this, we make use of the Fisher-Yates shuffle algorithm. We'll use a 'seed' value to generate these sequences, enabling the reproduction of the same sequence if needed, increasing predictability and testing convenience.

@drupol drupol marked this pull request as draft January 27, 2024 17:00
Copy link

github-actions bot commented Feb 5, 2024

Since this pull request has not had any activity within the last 5 days, I have marked it as stale.
I will close it if no further activity occurs within the next 5 days.

@github-actions github-actions bot added the stale label Feb 5, 2024
@github-actions github-actions bot closed this Feb 11, 2024
@drupol drupol reopened this Feb 11, 2024
@github-actions github-actions bot removed the stale label Feb 12, 2024
@drupol drupol force-pushed the refactor/randomIterableAggregate branch from 00a6812 to 2edb354 Compare February 13, 2024 07:29
@github-actions github-actions bot added the stale label Feb 18, 2024
@loophp loophp deleted a comment from github-actions bot Feb 18, 2024
@drupol drupol removed the stale label Feb 18, 2024
@drupol drupol marked this pull request as ready for review February 18, 2024 17:08
@drupol drupol merged commit 16a4979 into main Feb 18, 2024
13 of 14 checks passed
@drupol drupol deleted the refactor/randomIterableAggregate branch February 18, 2024 17:09
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant