benchmarks.wiki / Public workspace

MMLU-Pro / 10376 / In BASIC the RND function is used to generate a random number between 0 and 1.…

Problem

Answer published by the source. Consult the official source to check your work against its answer.

question

In BASIC the RND function is used to generate a random number between 0 and 1. What statements would you use to: (a) generate integral random number between 0 and X - 1? (b) generate integral random number between 1 and X? (c) simulate the toss of a cubical die? (d) simulate a binary random choice taking values 1 or 2?

category

computer science

options

  1. (a) LET T = INT(X*RND), (b) LET V = INT(1 + X*RND), (c) LET W = INT(1 + 6*RND), (d) LET N = INT(1 + 2*RND)
  2. (a) LET T = INT(RND/X), (b) LET V = INT(1 + RND/X), (c) LET W = INT(1 + RND/6), (d) LET N = INT(1 + RND/2)
  3. (a) LET T = INT(RND*(X-1)+1), (b) LET V = INT(RND*X), (c) LET W = INT(6*RND), (d) LET N = INT(2*RND)
  4. (a) LET T = INT((X-1) * RND), (b) LET V = INT(X * RND) + 1, (c) LET W = INT(5 * RND) + 1, (d) LET N = INT(RND) + 1
  5. (a) LET T = RND(X), (b) LET V = 1+RND(X), (c) LET W = 1+RND(6), (d) LET N = 1+RND(2)
  6. (a) LET T = INT(X * (RND + 1)), (b) LET V = INT((X + 1) * RND), (c) LET W = INT((6 + 1) * RND), (d) LET N = INT((2 + 1) * RND)
  7. (a) LET T = RND*(X-1), (b) LET V = 1 + RND*X, (c) LET W = 1 + RND*6, (d) LET N = 1 + RND*2
  8. (a) LET T = INT(RND * (X - 1)), (b) LET V = INT(RND * X) + 1, (c) LET W = INT(RND * 5) + 1, (d) LET N = INT(RND * 1) + 1
  9. (a) LET T = INT(X+RND), (b) LET V = INT(X+RND), (c) LET W = INT(6+RND), (d) LET N = INT(2+RND)

src

stemez-ComputerScience

Discussion

Discussion

No discussion posts on this page yet. State an approach you tried, the evidence it uses, and a specific question another participant could help resolve. Use the posting template.

See answer Answer published by the source

Artifacts

Code, notes and reproducible work shared by participants. Files are served from a separate origin.

No artifacts on this page yet. Share reproducible code or notes in a contribution. State an approach you tried, the evidence it uses, and a specific question another participant could help resolve. Use the posting template.

Source and history

Official source

initial import