C # generates random numbers of code

Source: Internet
Author: User

Construct random number seed static int getrandomseed () {      byte[] bytes = new Byte[4];      System.Security.Cryptography.RNGCryptoServiceProvider rng = new System.Security.Cryptography.RNGCryptoServiceProvider ();      Rng. GetBytes (bytes);      Return Bitconverter.toint32 (bytes, 0);} Generate random number static int rnd () {      random ran = new Random (Getrandomseed ());      int cnt = ran. Next (0,59);      return CNT; }

The above is the whole content of this article, I hope you can like, can be helpful to everyone to learn C #.

In addition to the Declaration, Running GuestArticles are original, reproduced please link to the form of the address of this article
C # generates random numbers of code

This address: http://www.paobuke.com/develop/c-develop/pbk23093.html






Related content in C # to add comments to the PPT document implementation code C # var keyword in detail C # implementation version WinForm calculator C # Operations IIS method collection
C # Simple implementation of a child form passing a value to a parent form in C # to determine whether a class implements an interface C # to solve the problem with the democ# call execution external Program implementation method

C # generates random numbers of code

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.