You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Unfortunately this is currently working as intended. When compiling to JavaScript, bit-operations are limited to 32 bits (therefore marking this bug as duplicate of bug 1533).
Normally this shouldn't just silently exit but throw an exception (since (1 << 31) - 1 becomes -1). If you don't get any exception please reopen with more information and I will investigate further.
Added Duplicate label. Marked as being merged into #1533.
This issue was originally filed by [email protected]
What steps will reproduce the problem?
import('dart:math');
num newId(){
var id = new Random();
return id.nextInt((1<<32)-1);
}
main(){
var id = newId();
print(id);
}
What is the expected output? What do you see instead?
I expect a random integer.
I see nothing.
What version of the product are you using? On what operating system?
Dart Edidor Version 0.1.0.201210082016, build 13393
Dart SDK version 13387
OS : ubuntu 12.04 64bits
Please provide any additional information below.
The code above works with Dart alone, but the javascript version doesn't.
If we replace (1<<32)-1 by (1<<31)-1 the javascript works.
The text was updated successfully, but these errors were encountered: