Re: Speed of Random Numbers

2019-08-04 Thread Daniel Kozak via Digitalmars-d-learn
You can try http://code.dlang.org/packages/mir-random I am using theme here: https://github.com/TechEmpower/FrameworkBenchmarks/blob/b9cc153dcd1c20e78197b0191536f0d11b8ca554/frameworks/D/vibed/source/postgresql.d#L49 On Sun, Aug 4, 2019 at 12:20 AM Giovanni Di Maria via Digitalmars-d-learn

Re: Speed of Random Numbers

2019-08-04 Thread Daniel Kozak via Digitalmars-d-learn
On Sun, Aug 4, 2019 at 11:49 AM Daniel Kozak wrote: > > You can try http://code.dlang.org/packages/mir-random > > I am using theme here: > https://github.com/TechEmpower/FrameworkBenchmarks/blob/b9cc153dcd1c20e78197b0191536f0d11b8ca554/frameworks/D/vibed/source/postgresql.d#L49 > > On Sun, Aug 4,

Re: Help me decide D or C

2019-08-04 Thread Aurélien Plazzotta via Digitalmars-d-learn
On Saturday, 3 August 2019 at 12:29:18 UTC, Russel Winder wrote: Knowing many paradigms well is proven experimentally (see the work by Petre, Green, Gilmore, and others) to improve capability in any given language. So knowing Java, Prolog, Lisp, Python, SQL, C, Go, Rust, D, Kotlin, Groovy,

Re: Question about ubyte x overflow, any safe way?

2019-08-04 Thread matheus via Digitalmars-d-learn
On Sunday, 4 August 2019 at 18:38:34 UTC, Paul Backus wrote: ... Use std.experimental.checkedint: import std.stdio; import std.experimental.checkedint; void main() { for(Checked!(ubyte, Throw) u = ubyte(250); u < 256; ++u) { writeln(u.get); } } An exception will be thrown when

Re: Question about ubyte x overflow, any safe way?

2019-08-04 Thread Ali Çehreli via Digitalmars-d-learn
On 08/04/2019 11:12 AM, matheus wrote: Hi, The snippet below will produce an "infinite loop" because obviously "ubyte u" will overflow after 255: import std.stdio; void main(){     ubyte u = 250;     for(;u<256;++u){     writeln(u);     } } Question: Is there a way (Flag) to prevent

Question about ubyte x overflow, any safe way?

2019-08-04 Thread matheus via Digitalmars-d-learn
Hi, The snippet below will produce an "infinite loop" because obviously "ubyte u" will overflow after 255: import std.stdio; void main(){ ubyte u = 250; for(;u<256;++u){ writeln(u); } } Question: Is there a way (Flag) to prevent this? Matheus.

Re: Question about ubyte x overflow, any safe way?

2019-08-04 Thread Max Haughton via Digitalmars-d-learn
On Sunday, 4 August 2019 at 18:12:48 UTC, matheus wrote: Hi, The snippet below will produce an "infinite loop" because obviously "ubyte u" will overflow after 255: import std.stdio; void main(){ ubyte u = 250; for(;u<256;++u){ writeln(u); } } Question: Is there a way

Re: Question about ubyte x overflow, any safe way?

2019-08-04 Thread matheus via Digitalmars-d-learn
On Sunday, 4 August 2019 at 18:15:30 UTC, Max Haughton wrote: What do you want to do? If you just want to count to 255 then use a foreach This was just an example, what I'd like in this code is either: Get an error (exception) when overflow or even an warning (Only if "some" flag was

Re: Question about ubyte x overflow, any safe way?

2019-08-04 Thread Paul Backus via Digitalmars-d-learn
On Sunday, 4 August 2019 at 18:22:30 UTC, matheus wrote: On Sunday, 4 August 2019 at 18:15:30 UTC, Max Haughton wrote: What do you want to do? If you just want to count to 255 then use a foreach This was just an example, what I'd like in this code is either: Get an error (exception) when

Re: Question about ubyte x overflow, any safe way?

2019-08-04 Thread Max Haughton via Digitalmars-d-learn
On Sunday, 4 August 2019 at 18:22:30 UTC, matheus wrote: On Sunday, 4 August 2019 at 18:15:30 UTC, Max Haughton wrote: What do you want to do? If you just want to count to 255 then use a foreach This was just an example, what I'd like in this code is either: Get an error (exception) when