ActionScript 3 数学基础知识

Posted

tags:

篇首语:本文由小常识网(cha138.com)小编为大家整理,主要介绍了ActionScript 3 数学基础知识相关的知识,希望对你有一定的参考价值。

n = Math.random();
// 0 <= n < 1

n = Math.round(x);
// rounds x to the closest integer

n = Math.floor(x);
// rounds x downwards to the closest integer

n = Math.ceil(x);
// rounds x upwards to the closest integer

n = Math.round(Math.random()*10);
// 0 <= n <= 10

n = Math.ceil(Math.random()*10);
// 1 <= n <= 10

n = Math.floor(Math.random()*10);
// 0 <= n <= 9

n = Math.random()*10 + 5;
// 5 <= n <= 15

n = Math.round(Math.random())*2 - 1;
// n will randomly be -1 or 1

以上是关于ActionScript 3 数学基础知识的主要内容,如果未能解决你的问题,请参考以下文章