ASF GitHub Bot commented on FLINK-4668:

GitHub user apivovarov opened a pull request:


    [FLINK-4668] Fix positive random int generation


You can merge this pull request into a Git repository by running:

    $ git pull https://github.com/apivovarov/flink FLINK-4668

Alternatively you can review and apply these changes as the patch at:


To close this pull request, make a commit to your master/trunk branch
with (at least) the following in the commit message:

    This closes #2539
commit 4ab1e4fa97fa41054817955230559766acbdf698
Author: Alexander Pivovarov <apivova...@gmail.com>
Date:   2016-09-23T06:26:27Z

    [FLINK-4668] Fix positive random int generation


> Fix positive random int generation
> ----------------------------------
>                 Key: FLINK-4668
>                 URL: https://issues.apache.org/jira/browse/FLINK-4668
>             Project: Flink
>          Issue Type: Bug
>          Components: Client
>            Reporter: Alexander Pivovarov
>            Priority: Trivial
> According to java spec
> {code}Math.abs(Integer.MIN_VALUE) == Integer.MIN_VALUE{code}
> So, {code}Math.abs(rnd.nextInt()){code} might return negative value
> To generate positive random int value we can use 
> {code}rnd.nextInt(Integer.MAX_VALUE){code}
> Integer.MAX_VALUE will be excluded btw

This message was sent by Atlassian JIRA

Reply via email to