Uploaded image for project: 'Minecraft: Java Edition'
  1. Minecraft: Java Edition
  2. MC-267902

/random error message states incorrect range size

XMLWordPrintable

    • Icon: Bug Bug
    • Resolution: Unresolved
    • None
    • 1.20.4, 23w51b, 24w03a, 24w03b, 24w04a, 24w05a, 24w05b, 1.20.5 Pre-Release 1, 1.20.6
    • Confirmed
    • Commands
    • Low
    • Platform

      Problem:

      When attempting to run /random with a range of 2147483647 (say /random roll 1..), the command will function correctly (as expected) generating a random value within a value range of size 2147483647. However, attempting to roll a larger range (say /random roll 0..) will display the error, "The range of the random value must be at most 2147483646," but the true maximum is 2147483647.

      This may be assumed to be correct if the range is defined as the max value minus the min value (as opposed to the number of possible integer outcomes), but if that is true, then it is instead the minimum value is incorrect. Ranges featuring only one number (/random roll 1) produce the error, "The range of the random value must be at least 2," even though /random roll 1..2 works fine (which, in this definition, would have a range size of 1).

      No matter which one is meant to be correct, the sizing of the range is inconsistent in these errors. 

      Solution:

      One of the following measures of range size needs to be consistently applied across these errors:

      1. Range size is the number of possible integer outcomes, given by max value minus min value plus 1 (1..2 has a size of 2, 1..217483647 has a size of 217483647)
      2. Range size is the max value minus min value (1..2 has a size of 1, 1..217483647 has a size of 217483646)

      Personally, I think the first definition makes more intuitive sense (especially for lower size ranges).

            Unassigned Unassigned
            SeacraftGaming Seacraft Gaming
            Votes:
            3 Vote for this issue
            Watchers:
            4 Start watching this issue

              Created:
              Updated:
              CHK: