Re: Speed of Random Numbers

2019-08-03 Thread Giovanni Di Maria via Digitalmars-d-learn
Thank you very much to Everybody! Giovanni

Where to put custom ldc2.conf (Windows)

2019-08-03 Thread NonNull via Digitalmars-d-learn
Perhaps I posted this to the wrong forum. Help needed. https://forum.dlang.org/post/pdqfquklkhambfccg...@forum.dlang.org

Re: Speed of Random Numbers

2019-08-03 Thread matheus via Digitalmars-d-learn
On Saturday, 3 August 2019 at 16:35:34 UTC, Giovanni Di Maria wrote: For me the "goodness of random" is NOT important. If that's the case, you could roll your own RNG: //DMD64 D Compiler 2.072.2 import std.stdio; import std.datetime; import std.array, std.random; void main(){ ubyte x;

Re: Speed of Random Numbers

2019-08-03 Thread bauss via Digitalmars-d-learn
On Saturday, 3 August 2019 at 17:47:46 UTC, Giovanni Di Maria wrote: On Saturday, 3 August 2019 at 17:44:44 UTC, lithium iodate wrote: On Saturday, 3 August 2019 at 16:35:34 UTC, Giovanni Di Maria wrote: [...] First off you could try to use a faster RNG engine than the default. The easiest

Re: Speed of Random Numbers

2019-08-03 Thread Dennis via Digitalmars-d-learn
On Saturday, 3 August 2019 at 16:35:34 UTC, Giovanni Di Maria wrote: Do you know other faster functions or methods to generate random numbers? For me the "goodness of random" is NOT important. I found some nice random functions in this public-domain C single-header library collection, one

Re: Speed of Random Numbers

2019-08-03 Thread Giovanni Di Maria via Digitalmars-d-learn
On Saturday, 3 August 2019 at 17:44:44 UTC, lithium iodate wrote: On Saturday, 3 August 2019 at 16:35:34 UTC, Giovanni Di Maria wrote: [...] First off you could try to use a faster RNG engine than the default. The easiest way is to define a variable containing it and passing it to the

Re: Speed of Random Numbers

2019-08-03 Thread lithium iodate via Digitalmars-d-learn
On Saturday, 3 August 2019 at 16:35:34 UTC, Giovanni Di Maria wrote: Do you know other faster functions or methods to generate random numbers? For me the "goodness of random" is NOT important. Thank you very much GIovanni Di Maria First off you could try to use a faster RNG engine than the

Re: Speed of Random Numbers

2019-08-03 Thread Giovanni Di Maria via Digitalmars-d-learn
On Saturday, 3 August 2019 at 17:17:23 UTC, Cym13 wrote: On Saturday, 3 August 2019 at 16:35:34 UTC, Giovanni Di Maria wrote: [...] To what extent isn't the quality of randomness important to you? Your posts reminds me of the way Doom (the original) did it for things like enemy behaviour

Re: Speed of Random Numbers

2019-08-03 Thread Cym13 via Digitalmars-d-learn
On Saturday, 3 August 2019 at 16:35:34 UTC, Giovanni Di Maria wrote: Hi to everybody I am doing some experiments about random numbers. I need "extreme speed" for the generation for numbers from 1 to 8. Generating 500_000_000 numbers with this code: - import

Speed of Random Numbers

2019-08-03 Thread Giovanni Di Maria via Digitalmars-d-learn
Hi to everybody I am doing some experiments about random numbers. I need "extreme speed" for the generation for numbers from 1 to 8. Generating 500_000_000 numbers with this code: - import std.stdio, std.array, std.random; void main() { byte c;

Re: How to get name of my application (project)

2019-08-03 Thread Jonathan M Davis via Digitalmars-d-learn
On Saturday, August 3, 2019 5:47:33 AM MDT Rémy Mouëza via Digitalmars-d- learn wrote: > On Saturday, 3 August 2019 at 09:26:03 UTC, Andrey wrote: > > Hello, how to get name of my application (project) that we > > write in dub.json? Is there any compile-time constant like > > __MODULE__? > > If I

Re: 1 new

2019-08-03 Thread Bastiaan Veelo via Digitalmars-d-learn
On Friday, 2 August 2019 at 18:25:28 UTC, jmh530 wrote: When I navigate to https://forum.dlang.org/ I have a message that says "1 new reply" to "your posts." Normally, I click on that "1 new reply" and find the post that's new, go to it, and the message disappears. However, it doesn't seem to

Re: How to get name of my application (project)

2019-08-03 Thread James Blachly via Digitalmars-d-learn
On 8/3/19 5:26 AM, Andrey wrote: Hello, how to get name of my application (project) that we write in dub.json? Is there any compile-time constant like __MODULE__? Dear Andrey: Perhaps this is similar to what you are looking for: https://dlang.org/spec/grammar.html#SpecialKeyword

Re: How to get name of my application (project)

2019-08-03 Thread drug via Digitalmars-d-learn
03.08.2019 12:26, Andrey пишет: Hello, how to get name of my application (project) that we write in dub.json? Is there any compile-time constant like __MODULE__? You can get it using $DUB_PACKAGE from Environment variables (https://dub.pm/package-format-sdl), for example using

Re: Can one customize unit tests?

2019-08-03 Thread Dennis via Digitalmars-d-learn
The out-of-the box unittest runner is pretty bare by design. It just runs unittest blocks in serial as functions where assert() failures are not undefined behavior. Assert messages are not very helpful, though the recently added flag `-checkaction=context` helps a lot. Luckily there is a

Can one customize unit tests?

2019-08-03 Thread PV via Digitalmars-d-learn
Is it possible to somehow customize syntax and running of unit tests? How I could use it: 1. Running only the tests from recently modified source files. 2. Ability to add optional timeout constraint into the tests, and then check whether the test doesn't exceed it. unittests (time <

Re: How to get name of my application (project)

2019-08-03 Thread Bastiaan Veelo via Digitalmars-d-learn
On Saturday, 3 August 2019 at 09:26:03 UTC, Andrey wrote: Hello, how to get name of my application (project) that we write in dub.json? Is there any compile-time constant like __MODULE__? The name of an application is not a compile time constant: you can rename the executable at any time.

Re: Help me decide D or C

2019-08-03 Thread Russel Winder via Digitalmars-d-learn
On Fri, 2019-08-02 at 20:24 +, Jon Degenhardt via Digitalmars-d-learn wrote: […] > In my view, the most important thing is the decision you've > already made - to pick a programming language and learn it in a > reasonable bit of depth. Which programming language you choose is > less

Re: [OT] Re: Using Haskell for teaching [was: Help me decide D or C]

2019-08-03 Thread Russel Winder via Digitalmars-d-learn
On Fri, 2019-08-02 at 23:24 -0600, Jonathan M Davis via Digitalmars-d-learn wrote: […] > The university I went to had an undergrad class on programming paradigms > that I _think_ was required (maybe two even), but it was definitely just the > focus of a small number of classes, whereas my

Re: Help me decide D or C

2019-08-03 Thread Russel Winder via Digitalmars-d-learn
On Fri, 2019-08-02 at 16:49 +, Alexandre via Digitalmars-d-learn wrote: […] > > Do you thing D would be the right tool for the job at this point > for me? Assuming I have 2 goals in mind: 1) become a better > programmer and 2) want to make fun writing software for myself > and if possible

Re: How to get name of my application (project)

2019-08-03 Thread Rémy Mouëza via Digitalmars-d-learn
On Saturday, 3 August 2019 at 09:26:03 UTC, Andrey wrote: Hello, how to get name of my application (project) that we write in dub.json? Is there any compile-time constant like __MODULE__? If I understand the question correctly, you are looking for std.file.thisExePath: -

Re: Help me decide D or C

2019-08-03 Thread Russel Winder via Digitalmars-d-learn
On Fri, 2019-08-02 at 17:25 +, berni via Digitalmars-d-learn wrote: > […] > > Yes, that was intentional. What I wanted to say is, that I think, > that it would have been better, if C was never invented at all... > In that case, there would have been space for an other language > for

Re: Can I remove an element from a global associative array from within a class destructor?

2019-08-03 Thread JN via Digitalmars-d-learn
On Friday, 2 August 2019 at 23:13:10 UTC, realhet wrote: Today I read the documentation about structs, unions and classes, but I haven't find any restrictions for the ~this() destructors. Is there some extra rules regarding the GC and what I must not do in the destructors? Class

How to get name of my application (project)

2019-08-03 Thread Andrey via Digitalmars-d-learn
Hello, how to get name of my application (project) that we write in dub.json? Is there any compile-time constant like __MODULE__?

Re: Can I remove an element from a global associative array from within a class destructor?

2019-08-03 Thread realhet via Digitalmars-d-learn
On Saturday, 3 August 2019 at 05:33:05 UTC, Jonathan M Davis wrote: On Friday, August 2, 2019 5:13:10 PM MDT realhet via Digitalmars-d-learn wrote: Hi, ... Thank you! Now I have 2 solutions in mind: 1. If I only want to track the count and totalBytes for a specific kind of reference, I will