Modify

Opened 12 years ago

Closed 11 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 Changed 12 years ago by guinness

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 Changed 12 years ago by jchd

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 Changed 12 years ago by Cor <autoit@…>

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 Changed 12 years ago by jchd

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 Changed 12 years ago by guinness

  • Type changed from Bug to Feature Request

comment:6 Changed 12 years ago by TicketCleanup

  • Version 3.3.8.1 deleted

Automatic ticket cleanup.

comment:7 Changed 11 years ago by Jon

  • Resolution set to Rejected
  • Status changed from new to closed

Guidelines for posting comments:

  • You cannot re-open a ticket but you may still leave a comment if you have additional information to add.
  • In-depth discussions should take place on the forum.

For more information see the full version of the ticket guidelines here.

Add Comment

Modify Ticket

Action
as closed The ticket will remain with no owner.
Author


E-mail address and user name can be saved in the Preferences.

 
Note: See TracTickets for help on using tickets.