-
-
Notifications
You must be signed in to change notification settings - Fork 869
Labels
BugSomething isn't working.Something isn't working.priority: HighHigh priority concern or feature request.High priority concern or feature request.
Description
Description
I expect that setting the seed to any positive integer, including zero, should lead to deterministic behavior. This is, for example, how Python's built-in random library works. However this is not the case for @stdlib/random-shuffle
; the seed seems to be silently ignored. Either seeding with zero should produce deterministic behavior, or it should fail loudly, just like with negative seed values.
Related Issues
Related issues # , # , and # .
Questions
No.
Demo
No response
Reproduction
In the node REPL:
> const shuffle = require('@stdlib/random-shuffle')
> shuffle.factory({ seed: 0 })([1,2,3])
> shuffle.factory({ seed: 0 })([1,2,3])
### Expected Results
```shell
Either
> const shuffle = require('@stdlib/random-shuffle')
> shuffle.factory({ seed: 0 })([1,2,3])
[[ SOME PERMUTATION ]]
> shuffle.factory({ seed: 0 })([1,2,3])
[[ THE SAME PERMUTATION ]]
or, throw an error and require strictly positive seeds.
### Actual Results
```shell
> const shuffle = require('@stdlib/random-shuffle')
> shuffle.factory({ seed: 0 })([1,2,3])
[ 3, 2, 1 ]
> shuffle.factory({ seed: 0 })([1,2,3])
[ 2, 3, 1 ]
### Version
0.2.1
### Environments
Node.js
### Browser Version
_No response_
### Node.js / npm Version
_No response_
### Platform
_No response_
### Checklist
- [X] Read and understood the [Code of Conduct](https://github.com/stdlib-js/stdlib/blob/develop/CODE_OF_CONDUCT.md).
- [X] Searched for existing issues and pull requests.
Metadata
Metadata
Assignees
Labels
BugSomething isn't working.Something isn't working.priority: HighHigh priority concern or feature request.High priority concern or feature request.