[
https://issues.apache.org/jira/browse/NIFI-1661?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=15244884#comment-15244884
]
ASF GitHub Bot commented on NIFI-1661:
--------------------------------------
Github user jskora commented on the pull request:
https://github.com/apache/nifi/pull/322#issuecomment-211107429
This looks pretty good, but in testing I came across 2 problems that need
to be addressed before it can be merged.
1. The example in the [expression language
guide](https://github.com/apache/nifi/pull/322/files#diff-daac74ec3b89e26d99806d7a90254fe3R1313)
should be `${random():mod(10):plus(1)}` since EL uses
[plus](http://nifi.apache.org/docs/nifi-docs/html/expression-language-guide.html#plus)
for addition.
1. Though Math.Random appears to only return positive floats, `nextLong()`
must be returning positive and negative numbers. Using the example expression
I get numbers between -100 and 100 showing in the attributes. The
documentation should reflect that this could be positive or negative and the
example needs to be adjusted for that as well.
In spite of the problems, nice job incorporating the EL Guide changes!
> Expression language should support a random function
> ----------------------------------------------------
>
> Key: NIFI-1661
> URL: https://issues.apache.org/jira/browse/NIFI-1661
> Project: Apache NiFi
> Issue Type: Improvement
> Reporter: Christopher McDermott
> Assignee: Joe Skora
> Priority: Minor
> Fix For: 0.7.0
>
>
> Random would be a subjectless function that generates a 32? bit random
> number. The random number generator need not be cryptographically secure.
> A use case would be for random be to generate a random pattern across some
> number of file paths to be used with putFile.
> Example - puts files randomly to /my-dirs/dir-1, /my-dirs/dir-2,
> /my-dirs/dir-3
> /my-dirs/dir-${random():mod(3):plus(1)}/
--
This message was sent by Atlassian JIRA
(v6.3.4#6332)