Example: The machine selected color ball into a functional problem. Public defines a function that can define multiple types, or define collections, and learn more about a function problem.

Source: Internet
Author: User

Public ArrayList Jixuanqiu (ArrayList red)//functions that define a collection type

{

Random r = new Random (); Machine Select 6 red ball process and sort

while (true)

{

if (red. Count = = 6)

{

Break

}

Else

{

int temp = R.next (1, 34);

if (!red. Contains (temp))

{

Red. ADD (temp);

}

}

}

Red. Sort ();

return red;

}

static void Main (string[] args)

{

while (true)

{

Random r = new Random ();

ArrayList red = new ArrayList ();

New program (). Jixuanqiu (red);

Output function

Console.Write ("Red ball for:");

for (int i = 0; i < 6; i++)

{

Console.Write (Red[i] + "\ t");

}

Console.Write ("Blue Ball for:" + r.next (1, 17));

Console.ReadLine ();

}

Example: The machine selected color ball into a functional problem. Public defines a function that can define multiple types, or define collections, and learn more about a function problem.

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.