[jira] [Commented] (CAMEL-8983) Add random function to simple

2015-07-22 Thread Andrea Cosentino (JIRA)

[ 
https://issues.apache.org/jira/browse/CAMEL-8983?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanelfocusedCommentId=14637174#comment-14637174
 ] 

Andrea Cosentino commented on CAMEL-8983:
-

Docs updated.

 Add random function to simple
 -

 Key: CAMEL-8983
 URL: https://issues.apache.org/jira/browse/CAMEL-8983
 Project: Camel
  Issue Type: Improvement
  Components: camel-core
Reporter: Claus Ibsen
Assignee: Andrea Cosentino
Priority: Minor
 Fix For: 2.16.0


 We be nice with a random function in simple so you can do random delays 
 during processor or whatnot
 {code}
 ${random(10)}
 {code}
 To return a random value between 0 and 9.
 And to do with range
 {code}
 ${random(10,20)}
 {code}
 To select a random number between 10 and 19.
 We may ponder a bit about the upper bound should be inclusive or exclusive?



--
This message was sent by Atlassian JIRA
(v6.3.4#6332)


[jira] [Commented] (CAMEL-8983) Add random function to simple

2015-07-22 Thread Andrea Cosentino (JIRA)

[ 
https://issues.apache.org/jira/browse/CAMEL-8983?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanelfocusedCommentId=14636404#comment-14636404
 ] 

Andrea Cosentino commented on CAMEL-8983:
-

Yeah, for sure.

 Add random function to simple
 -

 Key: CAMEL-8983
 URL: https://issues.apache.org/jira/browse/CAMEL-8983
 Project: Camel
  Issue Type: Improvement
  Components: camel-core
Reporter: Claus Ibsen
Assignee: Andrea Cosentino
Priority: Minor
 Fix For: 2.16.0


 We be nice with a random function in simple so you can do random delays 
 during processor or whatnot
 {code}
 ${random(10)}
 {code}
 To return a random value between 0 and 9.
 And to do with range
 {code}
 ${random(10,20)}
 {code}
 To select a random number between 10 and 19.
 We may ponder a bit about the upper bound should be inclusive or exclusive?



--
This message was sent by Atlassian JIRA
(v6.3.4#6332)


[jira] [Commented] (CAMEL-8983) Add random function to simple

2015-07-21 Thread Claus Ibsen (JIRA)

[ 
https://issues.apache.org/jira/browse/CAMEL-8983?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanelfocusedCommentId=14636233#comment-14636233
 ] 

Claus Ibsen commented on CAMEL-8983:


Could you add the random function to the docs at
http://camel.apache.org/simple

 Add random function to simple
 -

 Key: CAMEL-8983
 URL: https://issues.apache.org/jira/browse/CAMEL-8983
 Project: Camel
  Issue Type: Improvement
  Components: camel-core
Reporter: Claus Ibsen
Assignee: Andrea Cosentino
Priority: Minor
 Fix For: 2.16.0


 We be nice with a random function in simple so you can do random delays 
 during processor or whatnot
 {code}
 ${random(10)}
 {code}
 To return a random value between 0 and 9.
 And to do with range
 {code}
 ${random(10,20)}
 {code}
 To select a random number between 10 and 19.
 We may ponder a bit about the upper bound should be inclusive or exclusive?



--
This message was sent by Atlassian JIRA
(v6.3.4#6332)


[jira] [Commented] (CAMEL-8983) Add random function to simple

2015-07-20 Thread Andrea Cosentino (JIRA)

[ 
https://issues.apache.org/jira/browse/CAMEL-8983?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanelfocusedCommentId=14633083#comment-14633083
 ] 

Andrea Cosentino commented on CAMEL-8983:
-

Maybe the upper bound should be inclusive to avoid confusion.

 Add random function to simple
 -

 Key: CAMEL-8983
 URL: https://issues.apache.org/jira/browse/CAMEL-8983
 Project: Camel
  Issue Type: Improvement
  Components: camel-core
Reporter: Claus Ibsen
Priority: Minor

 We be nice with a random function in simple so you can do random delays 
 during processor or whatnot
 {code}
 ${random(10)}
 {code}
 To return a random value between 0 and 9.
 And to do with range
 {code}
 ${random(10,20)}
 {code}
 To select a random number between 10 and 19.
 We may ponder a bit about the upper bound should be inclusive or exclusive?



--
This message was sent by Atlassian JIRA
(v6.3.4#6332)


[jira] [Commented] (CAMEL-8983) Add random function to simple

2015-07-20 Thread Claus Ibsen (JIRA)

[ 
https://issues.apache.org/jira/browse/CAMEL-8983?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanelfocusedCommentId=14633110#comment-14633110
 ] 

Claus Ibsen commented on CAMEL-8983:


If you wanna take a stab at implementing this (it can be fun) then its to add 
it to
https://github.com/apache/camel/blob/master/camel-core/src/main/java/org/apache/camel/language/simple/ast/SimpleFunctionExpression.java#L218

You need to do your own little ( ) parsing to see if there is 1 or 2 numbers 
provided.

Then add unit tests to 
https://github.com/apache/camel/blob/master/camel-core/src/test/java/org/apache/camel/language/simple/SimpleTest.java#L1425

And I think the upper number should be exclusive so it works like the 
java.util.Random api
http://docs.oracle.com/javase/7/docs/api/java/util/Random.html#nextInt(int)

So if you want 0..9, then its random(10). And if you want 1..10, then its 
random(1,11)

 Add random function to simple
 -

 Key: CAMEL-8983
 URL: https://issues.apache.org/jira/browse/CAMEL-8983
 Project: Camel
  Issue Type: Improvement
  Components: camel-core
Reporter: Claus Ibsen
Priority: Minor

 We be nice with a random function in simple so you can do random delays 
 during processor or whatnot
 {code}
 ${random(10)}
 {code}
 To return a random value between 0 and 9.
 And to do with range
 {code}
 ${random(10,20)}
 {code}
 To select a random number between 10 and 19.
 We may ponder a bit about the upper bound should be inclusive or exclusive?



--
This message was sent by Atlassian JIRA
(v6.3.4#6332)


[jira] [Commented] (CAMEL-8983) Add random function to simple

2015-07-20 Thread Andrea Cosentino (JIRA)

[ 
https://issues.apache.org/jira/browse/CAMEL-8983?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanelfocusedCommentId=14633111#comment-14633111
 ] 

Andrea Cosentino commented on CAMEL-8983:
-

Nice :-)

 Add random function to simple
 -

 Key: CAMEL-8983
 URL: https://issues.apache.org/jira/browse/CAMEL-8983
 Project: Camel
  Issue Type: Improvement
  Components: camel-core
Reporter: Claus Ibsen
Priority: Minor

 We be nice with a random function in simple so you can do random delays 
 during processor or whatnot
 {code}
 ${random(10)}
 {code}
 To return a random value between 0 and 9.
 And to do with range
 {code}
 ${random(10,20)}
 {code}
 To select a random number between 10 and 19.
 We may ponder a bit about the upper bound should be inclusive or exclusive?



--
This message was sent by Atlassian JIRA
(v6.3.4#6332)