On Saturday, 21 December 2013 at 05:12:57 UTC, Chris Cain wrote:
For more information, I've written a document on an
implementation of uniform (which should be coming in 2.065,
btw) which discusses the issue with just using the modulus
operator:
https://dl.dropboxusercontent.com/u/2206555/unif
Do you mean I should have used :
if (uniform(0,10) == 7) {
instead ?
TL;DR version:
Actually, the equivalent would be uniform(0, 9), but yes,
that'd be the preferable approach there. (also note
https://github.com/jbrains/trivia/blob/7b473f9fbbd125b0ab1c2e82582b8a8c414ca501/d/source/trivia.d#L1
Chris Cain:
https://dl.dropboxusercontent.com/u/2206555/uniformUpgrade.pdf
From page 6:
size_t[] counts = new size_t[](top);
foreach(i; 0 .. 500_000_000)
counts[uniform(0, top)] += 1;
Modern D allows you to write better code:
size_t[N] counts;
foreach (immutable _; 0 .. 500_000_000)
On Saturday, 21 December 2013 at 15:03:34 UTC, bearophile wrote:
Chris Cain:
https://dl.dropboxusercontent.com/u/2206555/uniformUpgrade.pdf
From page 6:
size_t[] counts = new size_t[](top);
foreach(i; 0 .. 500_000_000)
counts[uniform(0, top)] += 1;
Modern D allows you to write better c
Meta:
I know immutable is a good thing, but don't you think
`immutable _` is a bit unnecessary in this case?
Some answer, choose the one you prefer:
1) Yes, it's totally useless because the _ variable is not even
used inside the loop body! So sorry, I'm always so pedantic.
2) It's necessar
Am Fri, 20 Dec 2013 15:53:08 +0100
schrieb "marcpmichel" :
>
> I participated in the "global day of code retreat 2013", and we
> had to do refactoring on a very ugly piece of code which was
> available on many languages.
> But there was no D version, so I made one (based on the java
> version)
On 12/22/2013 01:07 AM, Marco Leise wrote:
...
It didn't cause issues for any of the other students, but on
this particular computer the random seed that the Random ctor
chose caused a degenerate case where it never hit any of the 3
remaining indexes of the list.
The morale is that "uniform" ran
On 12/22/2013 02:09 AM, Timon Gehr wrote:
The morale is that "uniform" random numbers doesn't imply that
every value in the range will eventually be generated once!
Yes it does. (The probability that some value is never generated is 0.)
The actual morale is that random number generators do no
Thanks for all of the hard work, Jeremy.
DSFML is definitely one of the libraries helping D move forward
as a first class game development platform.
Regards,
Kelet
On Sunday, 22 December 2013 at 01:24:50 UTC, Kelet wrote:
Thanks for all of the hard work, Jeremy.
DSFML is definitely one of the libraries helping D move forward
as a first class game development platform.
Regards,
Kelet
oh and i guess no one use DirectX in AAA titles now, such a
shame...
On Saturday, 21 December 2013 at 20:43:27 UTC, bearophile wrote:
3) Just like the integer '5' a range of values as 0 .. 1000 is
an immutable value. So a variable that scans such range should
be immutable. If you really want to mutate such variable you
should add a modifier like "mutable" or "m
11 matches
Mail list logo