Skip to content

Commit

Permalink
lx_emul/random: fix reseed reset
Browse files Browse the repository at this point in the history
  • Loading branch information
cnuke committed Dec 16, 2024
1 parent c156c60 commit 33aa1ed
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion repos/dde_linux/src/lib/lx_emul/random.cc
Original file line number Diff line number Diff line change
Expand Up @@ -136,7 +136,7 @@ class Xoroshiro_128_plus_reseeding
_nr_of_gen_bytes += 8;
if (_nr_of_gen_bytes >= _nr_of_gen_bytes_limit) {
_reseed();
_nr_of_gen_bytes += 8;
_nr_of_gen_bytes = 8;
}
return _xoroshiro->get_u64();
}
Expand Down

2 comments on commit 33aa1ed

@chelmuth
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'd question that both _reseed() and get_u64() modify _nr_of_gen_bytes in this case, but the constructor does not initialize it to 8...

@cnuke
Copy link
Owner Author

@cnuke cnuke commented on 33aa1ed Dec 17, 2024

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

You are right, I missed the reset in _reseed(), which prompted me to do the adaption in the first place, and is the sole reason for resetting it to 8.

Please sign in to comment.