We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
In some situations I'd like to generate a random BigInt: import std.bigint: BigInt; import std.random: uniform; void main() { BigInt a = 0; BigInt b = BigInt(1) << 70; auto r = uniform(a, b); } Currently (DMD 2.062alpha) it gives: ...\dmd2\src\phobos\std\random.d(1106): Error: template std.random.uniform does not match any function template declaration. Candidates are: ...\dmd2\src\phobos\std\random.d(1104): std.random.uniform(string boundaries = "[)", T1, T2)(T1 a, T2 b) if (!is(CommonType!(T1, T2) == void)) ...\dmd2\src\phobos\std\random.d(1142): std.random.uniform(string boundaries = "[)", T1, T2, UniformRandomNumberGenerator)(T1 a, T2 b, ref UniformRandomNumberGenerator urng) if (isFloatingPoint!(CommonType!(T1, T2))) ...\dmd2\src\phobos\std\random.d(1175): std.random.uniform(string boundaries = "[)", T1, T2, UniformRandomNumberGenerator)(T1 a, T2 b, ref UniformRandomNumberGenerator urng) if (isIntegral!(CommonType!(T1, T2)) || isSomeChar!(CommonType!(T1, T2))) ...\dmd2\src\phobos\std\random.d(1255): std.random.uniform(T, UniformRandomNumberGenerator)(ref UniformRandomNumberGenerator urng) if (isIntegral!(T) || isSomeChar!(T)) ...\dmd2\src\phobos\std\random.d(1274): std.random.uniform(T)() if (isIntegral!(T) || isSomeChar!(T)) ...\dmd2\src\phobos\std\random.d(1106): ... (1 more, -v to show) ... ...\dmd2\src\phobos\std\random.d(1104): Error: template std.random.uniform cannot deduce template function from argument types !("[)",BigInt,BigInt,MersenneTwisterEngine!(uint, 32, 624, 397, 31, 2567483615u, 11, 7, 2636928640u, 15, 4022730752u, 18))(BigInt,BigInt,MersenneTwisterEngine!(uint, 32, 624, 397, 31, 2567483615u, 11, 7, 2636928640u, 15, 4022730752u, 18)) ...\dmd2\src\phobos\std\random.d(1106): Error: template instance uniform!("[)", BigInt, BigInt, MersenneTwisterEngine!(uint, 32, 624, 397, 31, 2567483615u, 11, 7, 2636928640u, 15, 4022730752u, 18)) errors instantiating template test.d(6): Error: template instance std.random.uniform!("[)", BigInt, BigInt) error instantiating
The text was updated successfully, but these errors were encountered:
No branches or pull requests
bearophile_hugs reported this on 2013-01-28T16:27:18Z
Transfered from https://issues.dlang.org/show_bug.cgi?id=9419
Description
In some situations I'd like to generate a random BigInt: import std.bigint: BigInt; import std.random: uniform; void main() { BigInt a = 0; BigInt b = BigInt(1) << 70; auto r = uniform(a, b); } Currently (DMD 2.062alpha) it gives: ...\dmd2\src\phobos\std\random.d(1106): Error: template std.random.uniform does not match any function template declaration. Candidates are: ...\dmd2\src\phobos\std\random.d(1104): std.random.uniform(string boundaries = "[)", T1, T2)(T1 a, T2 b) if (!is(CommonType!(T1, T2) == void)) ...\dmd2\src\phobos\std\random.d(1142): std.random.uniform(string boundaries = "[)", T1, T2, UniformRandomNumberGenerator)(T1 a, T2 b, ref UniformRandomNumberGenerator urng) if (isFloatingPoint!(CommonType!(T1, T2))) ...\dmd2\src\phobos\std\random.d(1175): std.random.uniform(string boundaries = "[)", T1, T2, UniformRandomNumberGenerator)(T1 a, T2 b, ref UniformRandomNumberGenerator urng) if (isIntegral!(CommonType!(T1, T2)) || isSomeChar!(CommonType!(T1, T2))) ...\dmd2\src\phobos\std\random.d(1255): std.random.uniform(T, UniformRandomNumberGenerator)(ref UniformRandomNumberGenerator urng) if (isIntegral!(T) || isSomeChar!(T)) ...\dmd2\src\phobos\std\random.d(1274): std.random.uniform(T)() if (isIntegral!(T) || isSomeChar!(T)) ...\dmd2\src\phobos\std\random.d(1106): ... (1 more, -v to show) ... ...\dmd2\src\phobos\std\random.d(1104): Error: template std.random.uniform cannot deduce template function from argument types !("[)",BigInt,BigInt,MersenneTwisterEngine!(uint, 32, 624, 397, 31, 2567483615u, 11, 7, 2636928640u, 15, 4022730752u, 18))(BigInt,BigInt,MersenneTwisterEngine!(uint, 32, 624, 397, 31, 2567483615u, 11, 7, 2636928640u, 15, 4022730752u, 18)) ...\dmd2\src\phobos\std\random.d(1106): Error: template instance uniform!("[)", BigInt, BigInt, MersenneTwisterEngine!(uint, 32, 624, 397, 31, 2567483615u, 11, 7, 2636928640u, 15, 4022730752u, 18)) errors instantiating template test.d(6): Error: template instance std.random.uniform!("[)", BigInt, BigInt) error instantiatingThe text was updated successfully, but these errors were encountered: