Hi,
Apologies for coming late to this thread.
I started with:
import std.random: uniform;
import std.range: iota;
import std.stdio: writeln;
void main() {
ulong sum;
foreach(i; iota(1_000_000_000)) {
if (uniform(0F,12F) > 6F) sum++;
}
On Monday, 24 September 2018 at 07:13:24 UTC, Chris Katko wrote:
On Monday, 24 September 2018 at 05:59:20 UTC, Chris Katko wrote:
[...]
Actually, I just realized/remembered that the error occurs
inside parallelism itself, and MANY times at that:
[...]
This JUST occurred to me. Wh
On Monday, 24 September 2018 at 05:59:20 UTC, Chris Katko wrote:
On Saturday, 22 September 2018 at 02:26:41 UTC, Chris Katko
wrote:
On Saturday, 22 September 2018 at 02:13:58 UTC, Chris Katko
wrote:
On Friday, 21 September 2018 at 12:15:59 UTC, Ali Çehreli
wrote:
On 09/21/2018 12:25 AM, Chris
On Saturday, 22 September 2018 at 02:26:41 UTC, Chris Katko wrote:
On Saturday, 22 September 2018 at 02:13:58 UTC, Chris Katko
wrote:
On Friday, 21 September 2018 at 12:15:59 UTC, Ali Çehreli
wrote:
On 09/21/2018 12:25 AM, Chris Katko wrote:
[...]
You can use a free-standing function as a wo
On Saturday, 22 September 2018 at 02:13:58 UTC, Chris Katko wrote:
On Friday, 21 September 2018 at 12:15:59 UTC, Ali Çehreli wrote:
On 09/21/2018 12:25 AM, Chris Katko wrote:
[...]
You can use a free-standing function as a workaround, which is
included in the following chapter that explains
On Friday, 21 September 2018 at 12:15:59 UTC, Ali Çehreli wrote:
On 09/21/2018 12:25 AM, Chris Katko wrote:
On Thursday, 20 September 2018 at 05:51:17 UTC, Neia Neutuladh
wrote:
On Thursday, 20 September 2018 at 05:34:42 UTC, Chris Katko
wrote:
All I want to do is loop from 0 to [constant] with
On 09/21/2018 12:25 AM, Chris Katko wrote:
On Thursday, 20 September 2018 at 05:51:17 UTC, Neia Neutuladh wrote:
On Thursday, 20 September 2018 at 05:34:42 UTC, Chris Katko wrote:
All I want to do is loop from 0 to [constant] with a for or foreach,
and have it split up across however many cores
On Friday, 21 September 2018 at 07:25:17 UTC, Chris Katko wrote:
I get "Error: template instance `reduce!((a, b) => a + b)`
cannot use local __lambda1 as parameter to non-global template
reduce(functions...)" when trying to compile that using the
online D editor with DMD and LDC.
Any ideas?
On Thursday, 20 September 2018 at 05:51:17 UTC, Neia Neutuladh
wrote:
On Thursday, 20 September 2018 at 05:34:42 UTC, Chris Katko
wrote:
All I want to do is loop from 0 to [constant] with a for or
foreach, and have it split up across however many cores I have.
You're looking at std.parallelism
On Thursday, 20 September 2018 at 05:34:42 UTC, Chris Katko wrote:
All I want to do is loop from 0 to [constant] with a for or
foreach, and have it split up across however many cores I have.
You're looking at std.parallelism.TaskPool, especially the amap
and reduce functions. Should do pretty
All I want to do is loop from 0 to [constant] with a for or
foreach, and have it split up across however many cores I have.
ulong sum;
foreach(i; [0 to 1 trillion])
{
//flip some dice using
float die_value = uniform(0F,12F);
if(die_value > [constant]) sum++;
11 matches
Mail list logo