Generate 8-bit non-repeated garbled characters

Source: Internet
Author: User

Author: Truly

 

Source code download

 


This is the core

Code

1 Private   Static   Long Getnext ( Int Seed)
2 {
3 Int Initseed = ( Int ) (Datetime. Now. ticks - Seed *   10000 );
4 Random ran =   New Random (initseed );
5 Double D;
6 Long RET;
7
8 Do
9 {
10 D = Ran. nextdouble ();
11 RET = Convert. toint64 (d * (Math. Pow ( 10 , 15 )));
12 }
13 While (Ret <= Min | RET > Max );
14
15 Return RET;
16 }

 

Then we use the combined array and the half-lookup method to process duplicate results. The result is random as the seed and the final result is obtained. Then, the 62 hexadecimal class is used to convert the result to 8 characters.

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.