Re: std.random question

2015-05-03 Thread Dennis Ritchie via Digitalmars-d-learn
On Sunday, 3 May 2015 at 08:42:57 UTC, tired_eyes wrote: Feels pretty silly, but I can't compile this: import std.random; auto i = uniform(0, 10); DMD spits this: /usr/include/dmd/phobos/std/random.d(1188): Error: static variable initialized cannot be read at compile time /usr/include/dmd/p

Re: std.random question

2015-05-03 Thread tired_eyes via Digitalmars-d-learn
On Sunday, 3 May 2015 at 08:48:52 UTC, Dennis Ritchie wrote: On Sunday, 3 May 2015 at 08:42:57 UTC, tired_eyes wrote: Feels pretty silly, but I can't compile this: import std.random; auto i = uniform(0, 10); DMD spits this: /usr/include/dmd/phobos/std/random.d(1188): Error: static variable

Re: std.random question

2015-05-03 Thread Dennis Ritchie via Digitalmars-d-learn
On Sunday, 3 May 2015 at 09:04:07 UTC, tired_eyes wrote: On Sunday, 3 May 2015 at 08:48:52 UTC, Dennis Ritchie wrote: On Sunday, 3 May 2015 at 08:42:57 UTC, tired_eyes wrote: Feels pretty silly, but I can't compile this: import std.random; auto i = uniform(0, 10); DMD spits this: /usr/incl

Re: std.random question

2015-05-03 Thread tired_eyes via Digitalmars-d-learn
Hmmm. hap.random from http://code.dlang.org/packages/hap behaves exactly the same.

Re: std.random question

2015-05-03 Thread biozic via Digitalmars-d-learn
On Sunday, 3 May 2015 at 09:28:40 UTC, Dennis Ritchie wrote: On Sunday, 3 May 2015 at 09:04:07 UTC, tired_eyes wrote: On Sunday, 3 May 2015 at 08:48:52 UTC, Dennis Ritchie wrote: On Sunday, 3 May 2015 at 08:42:57 UTC, tired_eyes wrote: Feels pretty silly, but I can't compile this: import std

Re: std.random question

2015-05-03 Thread tired_eyes via Digitalmars-d-learn
import std.random; struct Mystruct { int id; static opCall() { Mystruct s; s.id = uniform(0, 10); return s; } } void main() { auto s = Mystruct(); // whatever } --- This make sense, thant you for the e