Thread overview
Compile-Time RNG
Jan 20, 2016
CTRNG
Jan 21, 2016
tsbockman
Jan 21, 2016
Timon Gehr
Jan 21, 2016
tsbockman
Jan 21, 2016
Matthias Bentrup
Jan 21, 2016
tsbockman
Jan 21, 2016
Era Scarecrow
Jan 21, 2016
Brian Schott
January 20, 2016
I managed to create a compile-time random number generator.

Proof of concept, with some explanatory comments: http://dpaste.dzfl.pl/668646ce6d71

Just thought this might be of interest to some of you here.
January 21, 2016
On Wednesday, 20 January 2016 at 23:21:04 UTC, CTRNG wrote:
> I managed to create a compile-time random number generator.
>
> Proof of concept, with some explanatory comments: http://dpaste.dzfl.pl/668646ce6d71
>
> Just thought this might be of interest to some of you here.

That's clever (and devious).
January 21, 2016
On Wednesday, 20 January 2016 at 23:21:04 UTC, CTRNG wrote:
> I managed to create a compile-time random number generator.
>
> Proof of concept, with some explanatory comments: http://dpaste.dzfl.pl/668646ce6d71
>
> Just thought this might be of interest to some of you here.

That's nearly as fun as using the bsr and bsf functions in core.bitop to implement a pure random number generator.

https://issues.dlang.org/show_bug.cgi?id=14380
January 21, 2016
On 01/21/2016 01:32 AM, tsbockman wrote:
> On Wednesday, 20 January 2016 at 23:21:04 UTC, CTRNG wrote:
>> I managed to create a compile-time random number generator.
>>
>> Proof of concept, with some explanatory comments:
>> http://dpaste.dzfl.pl/668646ce6d71
>>
>> Just thought this might be of interest to some of you here.
>
> That's clever (and devious).

It only works because compile-time introspection is ill-defined though. I don't expect it to keep working indefinitely.
January 21, 2016
On Thursday, 21 January 2016 at 01:49:27 UTC, Timon Gehr wrote:
> It only works because compile-time introspection is ill-defined though. I don't expect it to keep working indefinitely.

That aspect can easily be replaced by __LINE__ and __FILE__.
January 21, 2016
On Thursday, 21 January 2016 at 07:43:13 UTC, tsbockman wrote:
> On Thursday, 21 January 2016 at 01:49:27 UTC, Timon Gehr wrote:
>> It only works because compile-time introspection is ill-defined though. I don't expect it to keep working indefinitely.
>
> That aspect can easily be replaced by __LINE__ and __FILE__.

A supported way to generate new names at compile time would be nice.
January 21, 2016
On Thursday, 21 January 2016 at 01:49:27 UTC, Timon Gehr wrote:
> On 01/21/2016 01:32 AM, tsbockman wrote:
>> On Wednesday, 20 January 2016 at 23:21:04 UTC, CTRNG wrote:
>>> Just thought this might be of interest to some of you here.
>>
>> That's clever (and devious).
>
> It only works because compile-time introspection is ill-defined though. I don't expect it to keep working indefinitely.

 Hmm it does seem having an RNG during compile-time would be useful, although I'm trying to come up with a use-case for when it would actually work, or how you'd use it.
January 21, 2016
On Thursday, 21 January 2016 at 09:29:38 UTC, Matthias Bentrup wrote:
>> That aspect can easily be replaced by __LINE__ and __FILE__.
>
> A supported way to generate new names at compile time would be nice.

It would, but in this particular case __LINE__ and __FILE__ actually provide a more natural way of solving the problem. The idea of generating new symbols to increment the counter is clever, but it's also an awkward hack.

__LINE__ already does pretty much what he needed by itself.