Are the following two distributions equivalent?import random
def dist5():
return int(random.random() * 10)
def dist6():
return random.randint(0, 10)
A: Yes
B: No
def dist5():
return int(random.random() * 10)
def dist6():
return random.randint(0, 10)
A: Yes
B: No
举一反三
- Are the following two distributions equivalent?import random<br/>def dist1():<br/>return random.random() * 2 - 1<br/>def dist2():<br/>if random.random() > 0.5:<br/>return random.random()<br/>else:<br/>return random.random() - 1 A: Yes B: No
- 使用random库的random()函数,哪个选项的方式是错误的_______。 A: from<br/>random import * B: from<br/>random import random C: import<br/>random D: import<br/>random from random
- 下列导入模块的方式中,错误的是(<br/>)。 A: import<br/>random B: from<br/>random import random C: from<br/>random import * D: from<br/>random
- 阅读下面的代码,输出结果是( )[br][/br] public static void main(String[] args) {[br][/br] Random random1 = new Random(10); [br][/br] Random random2 = new Random(10); [br][/br] for(int i=0;i[5;i++){<br] System.out.print(random1.nextInt(5));[br][/br] }[br][/br] System.out.println();[br][/br] for(int i=0;i[5;i++){<br] System.out.print(random2.nextInt(5));[br][/br] }[br][/br] } A: 3030130301 B: 5048132680 C: 3268023579 D: 1111111111
- 阅读下面的代码[br][/br]public static void main(String[] args) {[br][/br] Random random1 = new Random(10);[br][/br] Random random2 = new Random(10);[br][/br] for(int i=0;i[5;i++){<br] System.out.print(random1.nextInt(5));[br][/br] }[br][/br] System.out.println();[br][/br] for(int i=0;i[5;i++){<br] System.out.print(random2.nextInt(5));[br][/br] }[br][/br]} 下列选项中,程序的输出结果是()[br][/br] A. B. C. D. A: 3030130301 B: 5048132680 C: 3268023579 D: 1111111111