Using Java arrays to implement color ball select numbers

Source: Internet
Author: User

1  packagecom.hm.test;2 3 Importjava.util.Random;4 5 /**6 * Analog color ball generation7 * * * The random number of a basketball generated from 1 to 168 1 to 33 produces a random number of 6 red balls9  * @authorHMTen  */ one  public classDoublebar { a      -      public Static voidmain (string[] Args) { -         int[] A =Redbar (); the      -System.out.println ("the resulting color ball number is:"); -          -          for(inti = 0; I < a.length; i++){ +System.out.print (a[i] + ""); -         } + System.out.println (bluebar ()); a     } at      -     /*generate a random number of blue balls*/ -      public Static intBluebar () { -Random random =NewRandom (); -         returnRandom.nextint (16) + 1; -     } in      -     /*generate random numbers of 6 red balls*/ to      public Static int[] redbar () { +         int[] A =New int[6]; -Random random =NewRandom (); the          *         /*Save the resulting number in the array*/ $          for(inti = 0; I < 6; i + +){Panax Notoginsenga[i] = Random.nextint (33) + 1; -         } the         returna; +     } a  the}

Using Java arrays to implement color ball select numbers

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.