实现一个抽奖程序

package tx;

import java.util.Random;
import java.util.Scanner;
//实现一个抽奖程序
public class Price {
	
	public static void getPrice(int[] arr,int len){
		Random random = new Random();
		int id = random.nextInt(len);
		//把抽到的放到数组最后面,下次在前面部分抽
		int tmp = arr[id];
		arr[id] = arr[len-1];
		arr[len-1] = tmp;
	}
	public static void main(String[] args) {
		// TODO Auto-generated method stub
		Scanner scanner = new Scanner(System.in);
		while(scanner.hasNext()){
			int totalPerson = scanner.nextInt();
			int pricePerson = scanner.nextInt();
			int[] ids = new int[totalPerson];
			//给每个人编号
			for(int i=0;i
 
 

你可能感兴趣的:(面试)