符合中小企业对网站设计、功能常规化式的企业展示型网站建设
本套餐主要针对企业品牌型网站、中高端设计、前端互动体验...
商城网站建设因基本功能的需求不同费用上面也有很大的差别...
手机微信网站开发、微信官网、微信商城网站...
import java.util.Random;
创新互联服务项目包括金湾网站建设、金湾网站制作、金湾网页制作以及金湾网络营销策划等。多年来,我们专注于互联网行业,利用自身积累的技术优势、行业经验、深度合作伙伴关系等,向广大中小型企业、政府机构等提供互联网行业的解决方案,金湾网站推广取得了明显的社会效益与经济效益。目前,我们服务的客户以成都为中心已经辐射到金湾省份的部分城市,未来相信会继续扩大服务区域并继续获得客户的支持与信任!
public class Rand {
public static void main(String[] args) {
final int[] nums = new int[7];
Random rand = new Random();
for(int i = 0; i nums.length; i++){
int randNum = rand.nextInt(35);//simple test, the number not grater than 35
boolean isExistingNum = false;
//check whether it's already in the array;
for(int j =0; j i; j++){
if(nums[j] == randNum){
isExistingNum = true;
break;
}
}
if(isExistingNum){
i--;
}else{
nums[i] = randNum;
}
}
//print the array
for(int i = 0; i nums.length; i++){
System.out.println(nums[i]);
}
}
}
//见代码实现,测试通过
import java.util.ArrayList;
import java.util.Arrays;
import java.util.HashSet;
import java.util.Iterator;
import java.util.List;
import java.util.Random;
import java.util.Set;
public class RandomTest {
public static void main(String[] args) {
Random r = new Random();
List list = new ArrayListHashSet();
for (int i = 0; i 100; i++) {
Set set = new HashSetInteger();
int j = 0;
while (j 7) {
int random = r.nextInt(37);
if (!set.contains(random) random 0) {
set.add(random);
j++;
}
}
list.add(set);
}
int a[] = new int[700];
int j = 0;
for (int i = 0; i list.size(); i++) {
HashSet set = (HashSet) list.get(i);
Iterator it = set.iterator();
while (it.hasNext()) {
a[j] = Integer.parseInt(it.next().toString());
j++;
}
}
Arrays.sort(a);
int count = 0;
int c, d;
c = d = 1;
for (int i = 0; i a.length; i++) {
c = a[i];
if (d != c) {
System.out.println("出现" + d + ",次数:" + count);
d = c;
count = 0;
}
count++;
}
}
}
//36中(1~36)选6位
for (int i = 1; i =6 ; i++)
{
int k = (int)((36-1+1)*Math.random()+1);
System.out.println(k);
if (k==0)
{
break;
}
}
//32中(1~32)选1位
int k = (int)((32-1+1)*Math.random()+1);
System.out.println(k);
就是从36个数中选出7个,这36个数是什么可以自己指定,但必须保证不重复,我写的一个代码
public
class
test
{
public
static
void
main(String[]
args)
{
int[]
a
=
new
int[36];
for(int
i
=
0;
i
36;
++i)
a[i]
=
i+1;
for(int
i
=
0;
i
5;
++i)
randomSelect(a,
7);
}
static
void
randomSelect(int[]
a,
int
n)
{
randomShuffle(a,
7);
for(int
i
=
0;
i
n;
++i)
System.out.print(a[i]
+
"
");
System.out.println();
}
static
void
randomShuffle(int[]
a,
int
n)
{
for(int
i
=
0;
i
n;
++i)
{
int
r
=
(int)(Math.random()
*
a.length);
int
tmp
=
a[i];
a[i]
=
a[r];
a[r]
=
tmp;
}
}
}
public class test {
public static void main(String[] args) {
int a[] = new int[36];
for(int i = 0; i 36; ++i)
a[i] = i+1;
select(a, 7, 36);
}
static void select(int[] a, int n, int m) {
qsort(a, 0, m-1);
reverse(a, n, m-1);
print(a, 0, n-1);
int p = n;
while(true) {
if(p == 0)
break;
int k = p;
if(a[--p] a[k]) {
int r = m;
while(a[--r] a[p]);
if(p == 0 r == 1)
break;
if(r n)
continue;
swap(a, r, p);
if(k n) {
qsort(a, k, r-1);
reverse(a, n, r-1);
}
print(a, 0, n-1);
p = n;
}
}
}
static int c = 0;
static void print(int[] a, int i, int j) {
System.out.print("No." + ++c + " ");
for(int k = i; k = j; ++k)
System.out.print(a[k]+" ");
System.out.println();
}
static void swap(int[] a, int i, int j) {
int t = a[i];
a[i] = a[j];
a[j] = t;
}
static void reverse(int[] a, int i, int j) {
while(i j)
swap(a, i++, j--);
}
static void qsort(int[] a, int i, int j) {
while(i j) {
int s = i;
for(int k = i; k j; ++k)
if(a[k] a[j])
swap(a, s++, k);
swap(a, s, j);
qsort(a, i, s-1);
i = s + 1;
}
}
}
import java.io.*;
public class CaipiaoOne {
public static void main(String[] args) throws Exception {
int n = 0;
int[] num = new int[7];
System.out.print("请输入要生成的注数:");
BufferedReader in = new BufferedReader(new InputStreamReader(System.in));
n = Integer.parseInt(in.readLine());
int tmp = 0;
for(int i=0;in;i++){
for(int j=0;j7;j++){
tmp=(int)(Math.random()*36);
while(tmp==0)
tmp=(int)(Math.random()*36);
System.out.print(tmp+" ");
}
System.out.println();
}
}
}
//Lottery类
import java.util.Date;
class Lottery{
int[] num = new int[7];//用于存放随机产生的7个号码
//实现7个号码的产生
public void generate(){
int tmp;
for(int j=0;j7;j++){
tmp=(int)(Math.random()*36);
while(tmp==0)
tmp=(int)(Math.random()*36);
num[j]=tmp;
}
}
//实现票头的打印
public static void pringTitle(){
System.out.println("欢迎使用本彩票号码选择器");
System.out.println("********************");
System.out.println(new Date());
System.out.println();
}
//实现号码的打印
public void printData(){
for(int j=0;j7;j++){
System.out.print(num[j]+" ");
}
System.out.println();
}
public Lottery(){
generate();
printData();
}
}
//测试类
import java.io.*;
public class CaipiaoTwo {
public static void main(String[] args) throws Exception {
System.out.print("请输入要生成的注数:");
BufferedReader in = new BufferedReader(new InputStreamReader(System.in));
int n = Integer.parseInt(in.readLine());
Lottery.pringTitle();
for(int i=0;in;i++){
new Lottery();
}
}
}