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

オープン
#1 コメント 0 件 リアクション 0 件 担当者 0 名 GitHub で見る

まだ誰も着手していません。

評価

難易度
2/5
見積もり時間
1〜3時間
初心者へのやさしさ
45/100
issue の種類
バグ
明瞭さ
明確に書かれている
活発さ
停滞
領域
backend

調査の方向性

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.

索引モデルが issue の本文から書いたものです。

説明

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.

主要言語
Futhark
スター
4
フォーク
3
PR マージ指標
30日以内にマージされた PR はありません

コントリビューションガイド

このリポジトリのコントリビューションガイドは索引されていません

はじめの一歩

  1. issue を最後まで読み、次にプロジェクトのコントリビューションガイドを読みます。
  2. 着手することを issue にコメントします — 二人が同じ作業をするのを防げます。
  3. リポジトリをフォークし、ブランチを切って変更します。
  4. issue 番号を参照したプルリクエストを送ります。

似ている issue

Backend & API Design の issue をもっと見る

新しい issue をメールで受け取る

初心者向けの GitHub issue を短くまとめたダイジェスト。