Hi,

Is it intentional that random:integer lets you use zero or a negative value for 
$max, but random:seeded-integer errors out in those cases? I know these are 
edge cases. I'm only flagging them because of the inconsistency between the two 
similar functions.

(: Returns (0,0). :)
(random:integer(0),random:integer(-5))

(: Errors out :)
random:seeded-integer(31,1,0)

(: Errors out :)
random:seeded-integer(31,1,-5)


Here is the error information from the last command above.

Error:
Improper use? Potential bug? Your feedback is welcome:
Contact: basex-talk@mailman.uni-konstanz.de
Version: BaseX 7.9
Java: Oracle Corporation, 1.7.0_25
OS: Windows 7, amd64
Stack Trace: 
java.lang.IllegalArgumentException: n must be positive
        at java.util.Random.nextInt(Unknown Source)
        at org.basex.query.func.FNRandom$1.next(FNRandom.java:85)
        at org.basex.query.MainModule$1.next(MainModule.java:98)
        at org.basex.query.QueryContext.execute(QueryContext.java:598)
        at org.basex.query.QueryProcessor.execute(QueryProcessor.java:101)
        at org.basex.core.cmd.AQuery.query(AQuery.java:82)
        at org.basex.core.cmd.XQuery.run(XQuery.java:22)
        at org.basex.core.Command.run(Command.java:329)
        at org.basex.core.Command.execute(Command.java:94)
        at org.basex.gui.GUI.exec(GUI.java:417)
        at org.basex.gui.GUI.access$500(GUI.java:41)
        at org.basex.gui.GUI$8.run(GUI.java:361)


Cheers,
Amanda

Reply via email to