首页 > 编程知识 正文

数据结构printlist函数,java中random的使用方法

时间:2023-05-03 19:52:44 阅读:111369 作者:4655

package org.xiaowu.random.demo;

import java.util.Random;

import org.junit.Test;

公共类随机demo {

@Test

公共void demo () {

Random rnd=new Random (;

intcode=rnd.nextint(8999 ) 1000;

}

@Test

公共void demo1(

Random r=new Random (;

int nextInt=r.nextInt (;

RandomR1=newRandom(10;

int nextInt2=r1.nextInt (;

}

//*

@Test

公共void demo2() {

Random r=new Random (;

double d1=r.nextDouble (;

}

//*

@Test

公共void demo3() {

Random r=new Random (;

doubleD2=r.nextdouble(*5;

}

//*

@Test

公共void demo4() {

Random r=new Random (;

doubleD3=r.nextdouble(*1.51;

}

//*

@Test

公共void demo5() {

Random r=new Random (;

int n1=r.nextInt (;

}

//*

@Test

公共void demo6() {

Random r=new Random (;

intN2=r.nextint(10;

intN3=math.ABS(r.nextint( () );

}

//*

@Test

公共void demo7() {

Random r=new Random (;

intN3=r.nextint(11;

intN4=math.ABS(r.nextint( () );

}

//*

@Test

公共语音演示8 () {

Random r=new Random (;

intN4=r.nextint(18 )- 3;

intN5=math.ABS(r.nextint( ()- 3;

}

}

版权声明:该文观点仅代表作者本人。处理文章:请发送邮件至 三1五14八八95#扣扣.com 举报,一经查实,本站将立刻删除。