)]}'
{
  "commit": "bbdd32ec150e0ab1f25edc713f202c799ada17f4",
  "tree": "98f1ed6932b7dfda30987a6c2ddc81211362deaf",
  "parents": [
    "41a6e8c212c6d6cd2ae5abf77e8d3680c2801cfb"
  ],
  "author": {
    "name": "Laramie Leavitt",
    "email": "lar@google.com",
    "time": "Mon Nov 16 10:27:10 2026 -0800"
  },
  "committer": {
    "name": "Copybara-Service",
    "email": "copybara-worker@google.com",
    "time": "Mon Nov 16 14:36:24 2026 -0800"
  },
  "message": "Fix boundary and precision bugs in absl::Uniform and uniform_real_distribution\n\nFixes four classes of boundary and floating-point accuracy bugs in\n`absl::Uniform` and `absl::uniform_real_distribution`:\n\n1. Non-finite bounds and `std::nextafter` direction (`uniform_helper.h`):\n   - Guard `uniform_upper_bound` (`IntervalClosedClosed`,\n     `IntervalOpenClosed`) and `uniform_lower_bound` (`IntervalOpenClosed`,\n     `IntervalOpenOpen`) with `std::isfinite(...)` so `+/-inf` and `NaN`\n     are not stepped to `+/-max()`.\n   - Step `uniform_lower_bound` toward `+infinity()` rather than `b`,\n     preventing downward steps when `b \u003c a`.\n\n2. Raw range validation before shifting bounds (`uniform_helper.h`,\n   `distributions.h`):\n   - Add tag-aware `is_uniform_range_valid(tag, lo, hi)` overloads and\n     validate raw `(tag, lo, hi)` in `absl::Uniform` before shifting.\n   - Rejects empty `(x, x]`, `(x, x)`, inverted `lo \u003e hi`, and empty\n     integer boundaries `(INT_MAX, INT_MAX]` / `[INT_MIN, INT_MIN)`\n     without consuming URBG entropy, while preserving `[x, x)` on\n     floating-point types for backwards compatibility.\n\n3. Closed-upper real reachability and top-ULP erasure (`uniform_helper.h`,\n   `uniform_real_distribution.h`):\n   - `UniformDistributionWrapper` now tracks `closed_upper_` for\n     floating-point types instead of calling `std::nextafter(hi, max())`\n     on the distribution parameter, and samples closed-upper intervals via\n     `uniform_real_distribution::GenerateClosed`.\n   - Makes `DBL_MAX`/`FLT_MAX` reachable in closed-upper ranges (e.g.,\n     `[max - ulp, max]`, `(max - ulp, max]`, `[0, max]`, `[max, max]`)\n     and reaches `-1.0` and top ULPs in `[-10.0, -1.0]`.\n   - Retains `b()` / `(max)()` semantics via `uniform_upper_bound` for\n     mock validator compatibility.\n\n4. `uniform_real_distribution` `-DNDEBUG` overflow and sign-straddling\n   erasure (`uniform_real_distribution.h`):\n   - Keep non-negative finite `[lo, hi)` (`lo \u003e\u003d 0`, `range \u003e 0`) on the\n     existing `GenerateNonNegativeOpen` fast path so standard `[0, 1)`\n     output streams remain bit-identical.\n   - Split sign-straddling intervals (`lo \u003c 0 \u0026\u0026 hi \u003e 0`) at `0` using\n     `bernoulli_distribution` (with `double` ratio for `float` and\n     half-scaled overflow-safe ratio when `hi - lo` overflows to `+inf`),\n     fixing `uniform_real_distribution(lowest(), max())` returning\n     `+inf`/`NaN` in `-DNDEBUG` and fixing near-zero float erasure on\n     asymmetric intervals like `[-1.0f, 2^-25f)`.\n   - Use symmetric two-sided sampling (`GenerateSymmetric`) for negative\n     and closed-upper intervals to preserve top-ULP resolution near `hi`.\n\nPiperOrigin-RevId: 1022926310\n",
  "tree_diff": [
    {
      "type": "modify",
      "old_id": "42b59d3f3d31a6e6e633b6b9b65c7e54c4539653",
      "old_mode": 33188,
      "old_path": "absl/random/BUILD.bazel",
      "new_id": "b010013545388c3262e3bb305518c425587d4d80",
      "new_mode": 33188,
      "new_path": "absl/random/BUILD.bazel"
    },
    {
      "type": "modify",
      "old_id": "b2c3fa2f87e0eae4e2735f1faea538d21d6b616a",
      "old_mode": 33188,
      "old_path": "absl/random/CMakeLists.txt",
      "new_id": "c10b2140f2619c1a70a1eb226fa3554a7e36061f",
      "new_mode": 33188,
      "new_path": "absl/random/CMakeLists.txt"
    },
    {
      "type": "modify",
      "old_id": "8a032df60caaea3cc0318f77a7499181fddc4d6b",
      "old_mode": 33188,
      "old_path": "absl/random/distributions.h",
      "new_id": "f4c26b214ffe9b16ca7ab9e9e7b1479cd3ac085b",
      "new_mode": 33188,
      "new_path": "absl/random/distributions.h"
    },
    {
      "type": "modify",
      "old_id": "9b081e955ce212ba6c599809132633079249c654",
      "old_mode": 33188,
      "old_path": "absl/random/distributions_test.cc",
      "new_id": "5e77e5089d90b487ee516a6125982762d323807e",
      "new_mode": 33188,
      "new_path": "absl/random/distributions_test.cc"
    },
    {
      "type": "modify",
      "old_id": "04f9a27c2b612d733cadb82f7b08a5f29d72e557",
      "old_mode": 33188,
      "old_path": "absl/random/internal/BUILD.bazel",
      "new_id": "1fd56c8e200d47bb186e1dc22097afe5d1f0b6ac",
      "new_mode": 33188,
      "new_path": "absl/random/internal/BUILD.bazel"
    },
    {
      "type": "modify",
      "old_id": "aefbd00735212798c71d7e6b8e84d850166dc96e",
      "old_mode": 33188,
      "old_path": "absl/random/internal/uniform_helper.h",
      "new_id": "9c026afd2eb26b84b1849be5e8d9b45b714e89a9",
      "new_mode": 33188,
      "new_path": "absl/random/internal/uniform_helper.h"
    },
    {
      "type": "modify",
      "old_id": "e38b3b1cb8fe7372c9473c55132aef1b6492515e",
      "old_mode": 33188,
      "old_path": "absl/random/internal/uniform_helper_test.cc",
      "new_id": "2895614290dcd525476662b81bd9b0117be3b317",
      "new_mode": 33188,
      "new_path": "absl/random/internal/uniform_helper_test.cc"
    },
    {
      "type": "modify",
      "old_id": "79cf79336e88ea90cff0eceac2858346e217cb7d",
      "old_mode": 33188,
      "old_path": "absl/random/uniform_real_distribution.h",
      "new_id": "3076b42eda25ad5436e6c93ad8c58af04403c6d2",
      "new_mode": 33188,
      "new_path": "absl/random/uniform_real_distribution.h"
    },
    {
      "type": "modify",
      "old_id": "11e1d6581bddf00f942383d098dc76076657995b",
      "old_mode": 33188,
      "old_path": "absl/random/uniform_real_distribution_test.cc",
      "new_id": "f9cc93dad184400d8494e3419f3e5e314617870f",
      "new_mode": 33188,
      "new_path": "absl/random/uniform_real_distribution_test.cc"
    }
  ]
}
