• 2021-04-14
    【单选题】以下 () 表达式产生一个 10~30 之间 ( 含 10,30) 的随机整数
    A. Math.floor(Math.random()*21)+10 B. Math.floor(Math.random()*31)+20 C. Math. floor(Math.random()*20)+10 D. Math.ceil(Math.random()*30)+20
  • Math.floor(Math.random()*21)+10

    内容

    • 0

      使用Math对象的 random方法编制一个产生0-100(含1,100)之间的随机整数的函数.

    • 1

      Math类的random()方法可以产生一个()之间的()类型随机数。

    • 2

      以下代码:let color = Math。floor(Math。random( ) * 256)。toString(16) 运行后,color的值为( )。 A: 0~256之间的16进制随机数 B: 0~256之间的10进制随机数 C: 0~255之间的16进制随机数 D: 0~255之间的10进制随机数

    • 3

      下面那个语句可返回x的整数部分 A: import math math.ceil(x) B: from math import ceil ceil(x) C: import math math.trunc(x) D: import math math.fabs(x)

    • 4

      下列哪些语句是正确的Math对象方法 A: Math.random() B: Math.rnd() C: Math.max(数值1,数值2) D: Math.floor(数值)