Difference between revisions of "Rn1"

From NetHackWiki
Jump to navigation Jump to search
m (Text replace - "<ref>[ \ ]*{{[ \ ]*[sS]ourcecode[ \ ]*\|[ \ ]*([a-zA-Z_][a-zA-Z0-9_]*\.[ch])[ \ ]*\|[ \ ]*([0-9][0-9]*)[ \ ]*}}[ \ ]*<\/ref>" to "{{refsrc|$1|$2}}")
m (It would appear that the math tags prevent the template from being properly parsed.)
Line 1: Line 1:
 
{{DISPLAYTITLE:rn1}}
 
{{DISPLAYTITLE:rn1}}
{{randomvariable|name=rn1(x,y)|graph=rn1.svg|caption=[[wikipedia:Probability mass function|Probability mass function]] of rn1(10,5).|distribution=[[Wikipedia:discrete uniform distribution|uniform]]|mean=<math>(x-1)/2+y</math>|stddev=<math>\sqrt{(x^2-1)/12}</math>}}
+
{{randomvariable|name=rn1(x,y)|graph=rn1.svg|caption=[[wikipedia:Probability mass function|Probability mass function]] of rn1(10,5).|distribution=[[Wikipedia:discrete uniform distribution|uniform]]|mean=(x-1)/2+y|stddev=sqrt((x^2-1)/12)}}
 
rn1(x, y){{refsrc|hack.h|291}} is a pseudo-random number macro used in NetHack when a result should be unweighted. It is equivalent to ''rn2(x) + y''. The range of values is between y and y+x-1 inclusive (that is, y<=rn1(x,y)<x+y).  
 
rn1(x, y){{refsrc|hack.h|291}} is a pseudo-random number macro used in NetHack when a result should be unweighted. It is equivalent to ''rn2(x) + y''. The range of values is between y and y+x-1 inclusive (that is, y<=rn1(x,y)<x+y).  
  

Revision as of 10:08, 15 July 2015

rn1(x,y)
Distribution uniform
Mean (x-1)/2+y
Standard deviation sqrt((x^2-1)/12)

rn1(x, y)[1] is a pseudo-random number macro used in NetHack when a result should be unweighted. It is equivalent to rn2(x) + y. The range of values is between y and y+x-1 inclusive (that is, y<=rn1(x,y)<x+y).

See also rn2.

References

This page is a stub. Should you wish to do so, you can contribute by expanding this page.