herrDeng網內搜尋

自訂搜尋

Ads

2016年11月25日 星期五

Ex12 模擬大樂透並排序



陣列、亂數練習

15 則留言:

A10533012 提到...

import java.security.SecureRandom;
import java.util.Random;

public class aa {

public static void main(String[] args) {
Random rnd= new SecureRandom();
int[]x=new int[7];
outer: for(int i=0; i<x.length; i++){
x[i]=rnd.nextInt(49)+1;
for(int j=0; j<i; j++){
if(x[j]==x[j]){
i--;
continue outer;
}
}
System.out.print("x["+i+"]="+x[i]+"\t");
}
System.out.println();
}
}

A10533010 提到...

import java.security.SecureRandom;
import java.util.Random;

public class aa {

public static void main(String[] args) {
Random rnd= new SecureRandom();
int[]x=new int[7];
outer: for(int i=0; i<x.length; i++){
x[i]=rnd.nextInt(49)+1;
for(int j=0; j<i; j++){
if(x[j]==x[j]){
i--;
continue outer;
}
}
System.out.print("x["+i+"]="+x[i]+"\t");
}
System.out.println();
}
}

A10533013 提到...

import java.security.SecureRandom;
import java.util.Random;

public class aa {

public static void main(String[] args) {
Random rnd= new SecureRandom();
int[]x=new int[7];
outer: for(int i=0; i<x.length; i++){
x[i]=rnd.nextInt(49)+1;
for(int j=0; j<i; j++){
if(x[j]==x[j]){
i--;
continue outer;
}
}
System.out.print("x["+i+"]="+x[i]+"\t");
}
System.out.println();
}
}

A10533006林柏宇 提到...

import java.security.SecureRandom;
import java.util.Arrays;
public class ex1 {

public static void main(String[] args) {
System.out.println("產生亂數");
SecureRandom rnd=new SecureRandom();
int [] x=new int[7];
for(int i=0;i<x.length; i++){
x[i]=rnd.nextInt(49)+1;
outer: for(int j=0; j<i; j++){
if(x[j]==x[i]){
i--;
continue outer;
}
}
}
Arrays.sort(x);
for(int i=0; i<x.length; i++){
System.out.print(x[i]+"\t");
}
System.out.println();
}
}

A10533014 提到...

import java.security.SecureRandom;
import java.util.Arrays;

public class gvfdgfrgfdrgthgbfgf {

public static void main(String[] args) {
System.out.println("亂數產生");
SecureRandom rnd=new SecureRandom();
int [] x=new int[7];
outer: for(int i=0;i<x.length;i++){
x[i]=rnd.nextInt(49)+1;
for (int j = 0; j < i;j++) {
if(x[j]==x[i]){
i--;
continue outer;
}

}
}



Arrays.sort(x);
for(int i=0; i<x.length; i++){
System.out.print(x[i]+"\t");
}
System.out.println();
}
}

林子喬 提到...

package aaa;

import java.security.SecureRandom;
import java.util.Arrays;


public class bbbbb {
public static void main(String[] args) {
System.out.println("產生亂數");
SecureRandom rnd=new SecureRandom();
int [] x=new int[7];
outer: for(int i=0;i<x.length;i++){
x[i]=rnd.nextInt(49)+1;
for (int j = 0; j < i;j++) {
if(x[j]==x[i]) {
i--;
continue outer;
}
}
}
Arrays.sort(x);
for(int i=0; i<x.length; i++){
System.out.print(x[i]+"\t");

}
System.out.println();
}
}

A10533004易廷軒 提到...

import java.security.SecureRandom;
import java.util.Arrays;
public class ex2 {

public static void main(String[] args) {
System.out.println("產生亂數");
SecureRandom rnd= new SecureRandom();
int[] x=new int[7];
outer: for(int i=0; i<x.length; i++){
x[i]=rnd.nextInt(49)+1;
for(int j=0; j<i; j++){
if(x[j]==x[i]){
i--;
continue outer;
}
}
}
Arrays.sort(x);
for(int i=0; i<x.length; i++){
System.out.print(x[i]+"\t");
}
System.out.println();
}

}

A10533005 提到...

import java.security.SecureRandom;
import java.util.Arrays;

public class ex3 {

public static void main(String[] args) {
SecureRandom rnd=new SecureRandom();
System.out.println("產生亂數");
int x[]=new int[7];
outer: for(int i=0;i<x.length;i++){
x[i]=rnd.nextInt(49)+1;
for(int j=0;j<i;j++){
if(x[i]==x[j]){
i--;
continue outer;
}
}
}
System.out.println();
Arrays.sort(x);
for(int i=0;i<x.length;i++)
System.out.print(x[i]+"\t");
System.out.println();

}
}

A10533002 提到...

import java.security.SecureRandom;
import java.util.Arrays;

public class ex4 {

public static void main(String[] args) {
SecureRandom rnd=new SecureRandom();
System.out.println("產生亂數");
int[] x=new int[7];
outer: for(int i=0;i<x.length; i++){
x[i]=rnd.nextInt(49)+1;
for(int j=0; j<i;j++){
if(x[i]==x[j]){
i--;
continue outer;
}
}
}
Arrays.sort(x);
for(int i=0;i<x.length; i++){
System.out.print(x[i]+"\t");
}

System.out.println();

}
}

A10533011 提到...

import java.security.SecureRandom;
import java.util.Arrays;

public class ex3 {
public static void main(String[] args) {
System.out.println("產生亂數");
SecureRandom r = new SecureRandom();
int x[] = new int[7];
outer: for(int i=0;i<x.length;i++){
x[i]=r.nextInt(49)+1;
for(int j=0;j<i;j++){
if(x[i]==x[j]){
i--;
continue outer;
}
}
}
Arrays.sort(x);
for(int i=0;i<x.length;i++)
System.out.print(x[i]+"\t");
System.out.println();
}
}

a10533001 提到...

import java.security.SecureRandom;
import java.util.Arrays;

public class a4 {//大樂透
public static void main(String[] args) {
SecureRandom rnd=new SecureRandom(); //產生安全亂數
int[] x=new int[7];//7個位子 0123456
outer: for(int i=0;i<x.length;i++){//
x[i]=rnd.nextInt(49)+1;
for(int j=0;j<i;j++){
if(x[j]==x[i]){
i--;
continue outer;
}
}
System.out.print("["+i+"]="+x[i]+"\t");
}
System.out.println();
Arrays.sort(x);
for(int i=0;i<x.length;i++){
System.out.print("["+i+"]="+x[i]+"\t");
}
System.out.println();


}
}

A10533007 提到...

import java.security.SecureRandom;

public class yjhg {

public static void main(String[] args) {
SecureRandom rnd=new SecureRandom();
int [] x=new int[7];
outer: for(int i=0;i<x.length;i++){
x[i]=rnd.nextInt(49)+1;
for (int j = 0; j < i;j++) {
if(x[j]==x[i]){
i--;
continue outer;
}
}
System.out.println("x[" + i + "]=" + x[i] + "\t");
}
System.out.println();
}

}

A10533003 提到...

import java.security.SecureRandom;
import java.util.Arrays;

public class bv2 {

public static void main(String[] args) {
System.out.println("亂數產生");
SecureRandom rnd=new SecureRandom();
int [] x=new int[7];
outer: for(int i=0;i<x.length;i++){
x[i]=rnd.nextInt(49)+1;
for (int j = 0; j < i;j++) {
if(x[j]==x[i]){
i--;
continue outer;
}

}
}
Arrays.sort(x);
for(int i=0; i<x.length; i++){
System.out.print(x[i]+"\t");
}
System.out.println();
}
}

A10533003 提到...

import java.security.SecureRandom;
import java.util.Arrays;

public class bv2 {

public static void main(String[] args) {
System.out.println("亂數產生");
SecureRandom rnd=new SecureRandom();
int [] x=new int[7];
outer: for(int i=0;i<x.length;i++){
x[i]=rnd.nextInt(49)+1;
for (int j = 0; j < i;j++) {
if(x[j]==x[i]){
i--;
continue outer;
}

}
}
Arrays.sort(x);
for(int i=0; i<x.length; i++){
System.out.print(x[i]+"\t");
}
System.out.println();
}
}

B10233077 提到...

import java.security.SecureRandom;
import java.util.Arrays;

public class bv2 {

public static void main(String[] args) {
System.out.println("亂數產生");
SecureRandom rnd=new SecureRandom();
int [] x=new int[7];
outer: for(int i=0;i<x.length;i++){
x[i]=rnd.nextInt(49)+1;
for (int j = 0; j < i;j++) {
if(x[j]==x[i]){
i--;
continue outer;
}

}
}
Arrays.sort(x);
for(int i=0; i<x.length; i++){
System.out.print(x[i]+"\t");
}
System.out.println();
}
}

Related Posts Plugin for WordPress, Blogger...

熱門文章