Modify

Opened 13 years ago

Closed 13 years ago

#2322 closed Feature Request (Rejected)

Random() produces unexpected result.

Reported by: autoit@… Owned by:
Milestone: Component: AutoIt
Version: Severity: None
Keywords: Cc:

Description

If the MIN and MAX values are the same number, the result should be that number. Instead, Random() returns 0.

$foo = Random(1, 1, 1)
ConsoleWrite(".\" & @ScriptName & " (" & @ScriptLineNumber & ") : ==> " & "foo: " & $foo & @LF)

#cs
---------- RUN ----------
.\test.au3 (12) : ==> foo: 0

Output completed (0 sec consumed) - Normal Termination
#ce

Random(5, 5) also returns 0.

Attachments (0)

Change History (7)

comment:1 by guinness, 13 years ago

This is documented in the beta version of the help file that if the values are the same it returns 0 and sets @error to 1. So I can't see how it could be a bug but I will leave it for a developer to decide on whether this ticket is valid.

comment:2 by jchd, 13 years ago

This strongly counter-intuitive behavior is by design decision and has been questionned really many times before. A simple search would have found tickets 1538, 1251, 1170, 573 and 296, all of them closed under "no bug" tag.

While I consider the current behavior to be a terrible misconception I'm not in the position to change devs mind(s) on it. This ticket should now be a feature request.

comment:3 by Cor <autoit@…>, 13 years ago

A simple search revealed nothing. Thanks anyway. Feel free to file under a feature request, though simply stating the expected output in the current help file would be sufficient. It's trivial to work around once you know what's happening.

comment:4 by jchd, 13 years ago

Trac tickets can be searched and this what I was pointing out. Besides, this section is for posting confirmed bugs after inquiring on the help forum. BTW, simple search there on "random bug" lists several clearly relevant threads like this recent one.

Next time please post such question in the general help forum before overloading this section which is not for discussion.

Thanks.

comment:5 by guinness, 13 years ago

Type: BugFeature Request

comment:6 by TicketCleanup, 13 years ago

Version: 3.3.8.1

Automatic ticket cleanup.

comment:7 by Jon, 13 years ago

Resolution: Rejected
Status: newclosed

Modify Ticket

Action
as closed The ticket will remain with no owner.

Add Comment


E-mail address and name can be saved in the Preferences .
 
Note: See TracTickets for help on using tickets.