http://d.puremagic.com/issues/show_bug.cgi?id=6023



--- Comment #6 from Don <clugd...@yahoo.com.au> 2012-06-21 02:54:00 PDT ---
(In reply to comment #5)
> (In reply to comment #4)
> 
> > Because BigInt type is not integral.
> > 
> >   import std.traits;
> >   pragma(msg, isIntegral!BigInt);  // pritns false
> 
> Maybe we'll need to add to std.traits a new trait that's true for all integral
> values, BigInts too.

It's a bit difficult. If BigInt used the same algorithm for random number
generation that built-in ints use, the performance would be horrible.

For an n-byte number, you'd have O(2n) memory allocations on average, with an
unbounded worst case, instead of the single allocation you'd have with a
dedicated algorithm.

And generating a string of 1 million random bits is the sort of thing that
somebody is likely to do.

Supporting it with terrible performance isn't any better than not supporting it
at all.

-- 
Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email
------- You are receiving this mail because: -------

Reply via email to