http://tour.dlang.org/
On the "Controlling flow" page, the first paragraph says :
Sometimes you have to control your application's flow depending
on input parameters. if, else and if else are your friends then:
I think it's "if, else and else if are tour friends".
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
On Friday, 20 December 2013 at 15:05:07 UTC, bearophile wrote:
marcpmichel:
Here is the ugly thing :
https://github.com/jbrains/trivia/tree/master/d
And wrong:
if (rand.front() % 9 == 7) {
Bye,
bearophile
Do you mean I should have used :
if (uniform(0,10) == 7) {
instead ?
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) and pull-requested it.
Here is the ugly thing :
https://github.com/j