Use a string to generate 100 random numbers, and the random numbers generated by the same string at different times are different.

Source: Internet
Author: User
Previous process: 1. The service end sends 100 random numbers to the client. 2. The C ++ client then performs user operations and sends user operations to the server. 3. The server can reproduce the client user operation results based on the random number sent to the client and some parameters sent from the client... previous process:

1,The service end sends 100 random numbers to the client.
2. The C ++ client then performs user operations and sends user operations to the server.
3. The server can reproduce the client user operation results based on the random number sent to the client and some parameters sent from the client.

Hope the server can

1. Give one or several strings. The client and server use the same method to calculate 100 identical random numbers.
2. Different random numbers are generated for the same string at different times.

Reply content:

Previous process:

1,The service end sends 100 random numbers to the client.
2. The C ++ client then performs user operations and sends user operations to the server.
3. The server can reproduce the client user operation results based on the random number sent to the client and some parameters sent from the client.

Hope the server can

1. Give one or several strings. The client and server use the same method to calculate 100 identical random numbers.
2. Different random numbers are generated for the same string at different times.

First, connect the string to the timestamp, hash it, and then convert and split it according to the random number type you requested. However, this is not a random number.
This is calculated based on a certain algorithm. Because your seed is added with a timestamp, the numbers generated at different times are different.

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.