4
\$\begingroup\$

I posted a challenge that requires programs to generate a random number in a range, and one answer used the rgeom function from R. This function uses a geometric random distribution.

Is this allowed by default for challenges requiring values? I'm inclined to think not, since the dictionary definition in this case is "each [...] elements has equal probability of occurrence". I would assume only uniform (to the extent standard PRNGS are) random distributions are allowed.

\$\endgroup\$
2

2 Answers 2

11
\$\begingroup\$

Yes

From the tag wiki: "By default, random does not mean uniformly random, just that all valid outputs are possible."

This is to encourage answers to questions from esolangs where the probability distribution might not necessarily be uniform, or even non-esolang answers with neat tricks to save bytes.

Of course, you can always specify that answers have to be uniform, which would be appropriate in this case since you're talking about (presumably) fair dice rolls.

\$\endgroup\$
1
  • 5
    \$\begingroup\$ I think it's more to support C than esolangs. When your standard library only has "give me a random 32-bit integer" it's quite longwinded to get a uniform element of a set whose size isn't a power of two. \$\endgroup\$ Apr 15, 2019 at 13:10
9
\$\begingroup\$

Yes (specific to this answer)

The question asks for rolls of n on the uniform n-sided die to be rerolled. We can calculate the expected frequency of each possible number of rerolls and this is given by the geometric distribution. Rather than manually generating uniform rolls as necessary he's just predicting the number of uniform rolls of n that he would have randomly generated.

\$\endgroup\$
1
  • 1
    \$\begingroup\$ Ah, I missed that. Thanks. \$\endgroup\$
    – Riker
    Apr 13, 2019 at 3:09

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .