You are viewing a plain text version of this content. The canonical link for it is here.
Posted to devnull@infra.apache.org by "leventov (GitHub)" <gi...@apache.org> on 2018/08/24 01:20:13 UTC

[GitHub] [incubator-druid] leventov opened pull request #6226: Prohibit some Random usage patterns

- `Math.abs(random.nextInt())` doesn't guarantee positivity
- `random.nextInt() % x`
- `new Random()` should never be used, `ThreadLocalRandom.current()` or `SplittableRandom` instead.

I also replaced most `new Random(SOME_CONSTANT_SEED)` in benchmarks with `ThreadLocalRandom.current()` because benchmarks shouldn't generally be always identical, randomness between the runs could make results statistically more reliable.

[ Full content available at: https://github.com/apache/incubator-druid/pull/6226 ]
This message was relayed via gitbox.apache.org for devnull@infra.apache.org

[GitHub] [incubator-druid] jon-wei closed pull request #6226: Prohibit some Random usage patterns

Posted by "jon-wei (GitHub)" <gi...@apache.org>.
[ pull request closed by jon-wei ]

[ Full content available at: https://github.com/apache/incubator-druid/pull/6226 ]
This message was relayed via gitbox.apache.org for devnull@infra.apache.org

[GitHub] [incubator-druid] leventov commented on issue #6226: Prohibit some Random usage patterns

Posted by "leventov (GitHub)" <gi...@apache.org>.
@jon-wei fixed

[ Full content available at: https://github.com/apache/incubator-druid/pull/6226 ]
This message was relayed via gitbox.apache.org for devnull@infra.apache.org

[GitHub] [incubator-druid] jon-wei commented on issue #6226: Prohibit some Random usage patterns

Posted by "jon-wei (GitHub)" <gi...@apache.org>.
@leventov Can you fix conflicts?

[ Full content available at: https://github.com/apache/incubator-druid/pull/6226 ]
This message was relayed via gitbox.apache.org for devnull@infra.apache.org

[GitHub] [incubator-druid] glasser commented on pull request #6226: Prohibit some Random usage patterns

Posted by "glasser (GitHub)" <gi...@apache.org>.
Shouldn't this be Integer.SIZE rather than Integer.BYTES?  Just doing unit analysis it seems wrong: (bytes / (bits/symbol)) = symbol * (bytes/bits) = symbol/8.  This is giving single-character IDs for me, which seems wrong.

[ Full content available at: https://github.com/apache/incubator-druid/pull/6226 ]
This message was relayed via gitbox.apache.org for devnull@infra.apache.org

[GitHub] [incubator-druid] jon-wei commented on pull request #6226: Prohibit some Random usage patterns

Posted by "jon-wei (GitHub)" <gi...@apache.org>.
@glasser This was fixed in #6383

[ Full content available at: https://github.com/apache/incubator-druid/pull/6226 ]
This message was relayed via gitbox.apache.org for devnull@infra.apache.org

[GitHub] [incubator-druid] glasser commented on pull request #6226: Prohibit some Random usage patterns

Posted by "glasser (GitHub)" <gi...@apache.org>.
I guess that'll teach me to run off of a random commit on master :)

[ Full content available at: https://github.com/apache/incubator-druid/pull/6226 ]
This message was relayed via gitbox.apache.org for devnull@infra.apache.org