Copilot commented on code in PR #12624:
URL: https://github.com/apache/trafficserver/pull/12624#discussion_r2475778398
##########
include/tscore/Random.h:
##########
@@ -33,24 +33,28 @@ class Random
static uint64_t
random()
{
- std::uniform_int_distribution<uint64_t> dist{0, UINT64_MAX};
- return dist(_engine);
+ return _state.int_dist(_state.engine);
}
static double
drandom()
{
- std::uniform_real_distribution<double> dist{0, 1};
- return dist(_engine);
+ return _state.real_dist(_state.engine);
}
static void
seed(uint64_t s)
{
- _engine.seed(s);
+ _state.engine.seed(s);
Review Comment:
After seeding the engine, the distribution objects (`int_dist` and
`real_dist`) should be reset to ensure proper behavior. Distribution objects
maintain internal state that can affect the generated sequence. Consider
calling `_state.int_dist.reset()` and `_state.real_dist.reset()` after seeding.
```suggestion
_state.engine.seed(s);
_state.int_dist.reset();
_state.real_dist.reset();
```
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]