mirror of
https://github.com/scratchfoundation/scratch-vm.git
synced 2024-12-24 06:52:40 -05:00
Switch from parseInt to Math.floor
This commit is contained in:
parent
2665ef2b2b
commit
525b601253
1 changed files with 2 additions and 2 deletions
|
@ -85,7 +85,7 @@ class Scratch3OperatorsBlocks {
|
||||||
if (low === high) return low;
|
if (low === high) return low;
|
||||||
// If both arguments are ints, truncate the result to an int.
|
// If both arguments are ints, truncate the result to an int.
|
||||||
if (Cast.isInt(args.FROM) && Cast.isInt(args.TO)) {
|
if (Cast.isInt(args.FROM) && Cast.isInt(args.TO)) {
|
||||||
return low + parseInt(Math.random() * ((high + 1) - low), 10);
|
return low + Math.floor(Math.random() * ((high + 1) - low));
|
||||||
}
|
}
|
||||||
return (Math.random() * (high - low)) + low;
|
return (Math.random() * (high - low)) + low;
|
||||||
}
|
}
|
||||||
|
@ -107,7 +107,7 @@ class Scratch3OperatorsBlocks {
|
||||||
length (args) {
|
length (args) {
|
||||||
return Cast.toString(args.STRING).length;
|
return Cast.toString(args.STRING).length;
|
||||||
}
|
}
|
||||||
|
|
||||||
contains (args) {
|
contains (args) {
|
||||||
const format = function (string) {
|
const format = function (string) {
|
||||||
return Cast.toString(string).toLowerCase();
|
return Cast.toString(string).toLowerCase();
|
||||||
|
|
Loading…
Reference in a new issue