Computing desk | ||
---|---|---|
< August 23 | << Jul | August | Sep >> | August 25 > |
Welcome to the Wikipedia Computing Reference Desk Archives |
---|
The page you are currently viewing is an archive page. While you can leave answers for any questions shown below, please ask new questions on one of the current reference desk pages. |
Java's documentation for Random.nextDouble() states that the output is a 53-bit random integer divided by 253. This means that the chance of it being less than a given very small number is always a multiple of 2-53, so the abstraction that Random.nextDouble() is continuously distributed is leakier than necessary. For the default implementation of java.util.Random, which fails many standard tests of randomness much faster than if it only failed by exposing the rounding, this isn't a problem; but for better PRNG implementations it may be. What are the best algorithms for generating pseudorandom floating-point numbers that can be any value in the range [0.0, 1.0), including the denormals, with probability inversely proportional to their distance from consecutive values? (A tempting solution would be to use a BigDecimal, generating digits until some number after the first nonzero, but I doubt this is very efficient.) Neon Merlin 20:09, 24 August 2017 (UTC)
I noticed that typing {{:The Simpsons}} (with a colon after the opening brackets) returns the number of episodes of The Simpsons, taken from Wikidata.
Test: {{ The Simpsons}}
How does this work? What is the logic behind that wikitext? Does it have anything to do with Template:The Simpsons?
I would be fine with reading a documentation page about this, if any. -- Daniel Carrero ( talk) 23:50, 24 August 2017 (UTC)
num_episodes=<onlyinclude>618</onlyinclude>
. As you may have guessed, <onlyinclude>
makes MediaWiki only include whatever's inside it when the page is transcluded. If you're not up on template features, {{:The Simpsons}}
tells MediaWiki to transclude
The Simpsons. The colon tells it to look at the Main namespace. For more, see:
meta:Help:Template and
mw:Help:Templates. --
47.138.161.183 (
talk)
02:57, 25 August 2017 (UTC)
Computing desk | ||
---|---|---|
< August 23 | << Jul | August | Sep >> | August 25 > |
Welcome to the Wikipedia Computing Reference Desk Archives |
---|
The page you are currently viewing is an archive page. While you can leave answers for any questions shown below, please ask new questions on one of the current reference desk pages. |
Java's documentation for Random.nextDouble() states that the output is a 53-bit random integer divided by 253. This means that the chance of it being less than a given very small number is always a multiple of 2-53, so the abstraction that Random.nextDouble() is continuously distributed is leakier than necessary. For the default implementation of java.util.Random, which fails many standard tests of randomness much faster than if it only failed by exposing the rounding, this isn't a problem; but for better PRNG implementations it may be. What are the best algorithms for generating pseudorandom floating-point numbers that can be any value in the range [0.0, 1.0), including the denormals, with probability inversely proportional to their distance from consecutive values? (A tempting solution would be to use a BigDecimal, generating digits until some number after the first nonzero, but I doubt this is very efficient.) Neon Merlin 20:09, 24 August 2017 (UTC)
I noticed that typing {{:The Simpsons}} (with a colon after the opening brackets) returns the number of episodes of The Simpsons, taken from Wikidata.
Test: {{ The Simpsons}}
How does this work? What is the logic behind that wikitext? Does it have anything to do with Template:The Simpsons?
I would be fine with reading a documentation page about this, if any. -- Daniel Carrero ( talk) 23:50, 24 August 2017 (UTC)
num_episodes=<onlyinclude>618</onlyinclude>
. As you may have guessed, <onlyinclude>
makes MediaWiki only include whatever's inside it when the page is transcluded. If you're not up on template features, {{:The Simpsons}}
tells MediaWiki to transclude
The Simpsons. The colon tells it to look at the Main namespace. For more, see:
meta:Help:Template and
mw:Help:Templates. --
47.138.161.183 (
talk)
02:57, 25 August 2017 (UTC)