http://d.puremagic.com/issues/show_bug.cgi?id=9339
--- Comment #5 from [email protected] 2013-01-17 16:52:13 PST --- (In reply to comment #3) [...] > I think this is more efficient: > > > T uniform(T)() > if (is(T == enum) && isIntegral!T || isSomeChar!T) > { > static immutable T[EnumMembers!T.length] members = [EnumMembers!T]; > return members[std.random.uniform(0, members.length)]; > } You're right, we want the array to be statically initialized. Does enum arr = [...] cause the code to create the array every time the function is called? -- Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email ------- You are receiving this mail because: -------
