[Home]

Summary:ASTERISK-06800: application random() is never true when probability is 1 (as in random(1:$ARGS))
Reporter:furiousgeorge (furiousgeorge)Labels:
Date Opened:2006-04-17 19:04:41Date Closed:2006-04-18 01:30:00
Priority:MinorRegression?No
Status:Closed/CompleteComponents:Applications/General
Versions:Frequency of
Occurrence
Related
Issues:
Environment:Attachments:
Description:if random() is fed 1 for the probability integer, there is never a strike.  I have it from a good source that this is replicable, but for the record I use gentoo-2.6.15 and I've olny tested it with asterisk 1.2.6 for X86.


****** ADDITIONAL INFORMATION ******

this will make it happen

[random_bug]
exten => s,1,while(1)
exten => s,2,Random(1:s,4)
exten => s,3,endwhile
exten => s,4,hangup
Comments:By: Jason Parker (jparker) 2006-04-17 19:12:13

and 100 also has a chance of being false...

I think the proper fix is to change the > 100 to >= 100.

tholo was saying to change the % 100 to % 101, but that would still lead to incorrect results, in my opinion.  Will upload patch against 1.2 and trunk shortly.

By: Tilghman Lesher (tilghman) 2006-04-18 01:30:00

Committed to 1.2, merged to trunk.