uniform_int_distribution misbehaves if the range exceeds the range of the underlying rng_engine

Đang mở
#1 0 bình luận 0 reaction 0 người được giao Xem trên GitHub

Chưa có ai nhận issue này.

Đánh giá

Độ khó
2/5
Thời gian dự kiến
1-3 giờ
Mức phù hợp với người mới
45/100
Loại issue
Lỗi
Độ rõ ràng
Đặc tả rõ ràng
Mức độ hoạt động
Đình trệ
Lĩnh vực
backend

Hướng nghiên cứu

Start at lib/github.com/diku-dk/cpprandom/random.fut lines 486-487, focusing on the loop that computes secure_max for uniform_int_distribution. Reproduce the supplied program and confirm that the distribution terminates when the requested range exceeds the underlying rng range, without leaving the distribution unbalanced.

Do mô hình lập chỉ mục viết ra từ nội dung của issue.

Mô tả

bug hacktoberfest

For example, this program will not terminate:

import "lib/github.com/diku-dk/cpprandom/random"

module rng = minstd_rand
module dist = uniform_int_distribution u32 rng

let main (seed: i32) =
  let r = rng.rng_from_seed [seed]
  in dist.rand (rng.min,rng.max+1) r

The problem is this loop where it tries to ensure that the distribution is not unbalanced. If the range is too great, then secure_max becomes 0, and the loop becomes infinite.

Ngôn ngữ chính
Futhark
Star
4
Fork
3
Chỉ số merge pull request
Không có pull request nào được merge trong 30 ngày

Hướng dẫn đóng góp

Chưa lập chỉ mục được hướng dẫn đóng góp cho kho mã nguồn này

Bắt đầu từ đâu

  1. Đọc hết issue, rồi đọc hướng dẫn đóng góp của dự án.
  2. Bình luận trên issue rằng bạn sẽ nhận — tránh hai người làm cùng một việc.
  3. Fork repository và làm thay đổi trên một nhánh.
  4. Mở pull request có tham chiếu số hiệu của issue.

Issue tương tự

Thêm issue về Backend & API Design

Nhận issue mới trong hộp thư của bạn

Bản tóm tắt ngắn những issue GitHub phù hợp với người mới.