You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@flink.apache.org by "ASF GitHub Bot (JIRA)" <ji...@apache.org> on 2016/09/23 06:28:20 UTC
[jira] [Commented] (FLINK-4668) Fix positive random int generation
[ https://issues.apache.org/jira/browse/FLINK-4668?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=15515563#comment-15515563 ]
ASF GitHub Bot commented on FLINK-4668:
---------------------------------------
GitHub user apivovarov opened a pull request:
https://github.com/apache/flink/pull/2539
[FLINK-4668] Fix positive random int generation
https://issues.apache.org/jira/browse/FLINK-4668
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:
https://github.com/apache/flink/pull/2539.patch
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 <ap...@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
(v6.3.4#6332)