CN106611309A - Information processing device and method - Google Patents
Information processing device and method Download PDFInfo
- Publication number
- CN106611309A CN106611309A CN201510698435.2A CN201510698435A CN106611309A CN 106611309 A CN106611309 A CN 106611309A CN 201510698435 A CN201510698435 A CN 201510698435A CN 106611309 A CN106611309 A CN 106611309A
- Authority
- CN
- China
- Prior art keywords
- red packet
- money
- amount
- distribution
- unit
- Prior art date
- Legal status (The legal status is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the status listed.)
- Pending
Links
Classifications
-
- G—PHYSICS
- G06—COMPUTING; CALCULATING OR COUNTING
- G06Q—INFORMATION AND COMMUNICATION TECHNOLOGY [ICT] SPECIALLY ADAPTED FOR ADMINISTRATIVE, COMMERCIAL, FINANCIAL, MANAGERIAL OR SUPERVISORY PURPOSES; SYSTEMS OR METHODS SPECIALLY ADAPTED FOR ADMINISTRATIVE, COMMERCIAL, FINANCIAL, MANAGERIAL OR SUPERVISORY PURPOSES, NOT OTHERWISE PROVIDED FOR
- G06Q20/00—Payment architectures, schemes or protocols
- G06Q20/30—Payment architectures, schemes or protocols characterised by the use of specific devices or networks
- G06Q20/36—Payment architectures, schemes or protocols characterised by the use of specific devices or networks using electronic wallets or electronic money safes
- G06Q20/363—Payment architectures, schemes or protocols characterised by the use of specific devices or networks using electronic wallets or electronic money safes with the personal data of a user
-
- G—PHYSICS
- G06—COMPUTING; CALCULATING OR COUNTING
- G06Q—INFORMATION AND COMMUNICATION TECHNOLOGY [ICT] SPECIALLY ADAPTED FOR ADMINISTRATIVE, COMMERCIAL, FINANCIAL, MANAGERIAL OR SUPERVISORY PURPOSES; SYSTEMS OR METHODS SPECIALLY ADAPTED FOR ADMINISTRATIVE, COMMERCIAL, FINANCIAL, MANAGERIAL OR SUPERVISORY PURPOSES, NOT OTHERWISE PROVIDED FOR
- G06Q20/00—Payment architectures, schemes or protocols
- G06Q20/30—Payment architectures, schemes or protocols characterised by the use of specific devices or networks
- G06Q20/36—Payment architectures, schemes or protocols characterised by the use of specific devices or networks using electronic wallets or electronic money safes
- G06Q20/367—Payment architectures, schemes or protocols characterised by the use of specific devices or networks using electronic wallets or electronic money safes involving electronic purses or money safes
- G06Q20/3678—Payment architectures, schemes or protocols characterised by the use of specific devices or networks using electronic wallets or electronic money safes involving electronic purses or money safes e-cash details, e.g. blinded, divisible or detecting double spending
Landscapes
- Business, Economics & Management (AREA)
- Accounting & Taxation (AREA)
- Finance (AREA)
- Engineering & Computer Science (AREA)
- Computer Networks & Wireless Communication (AREA)
- Strategic Management (AREA)
- Physics & Mathematics (AREA)
- General Business, Economics & Management (AREA)
- General Physics & Mathematics (AREA)
- Theoretical Computer Science (AREA)
- Financial Or Insurance-Related Operations Such As Payment And Settlement (AREA)
Abstract
The invention provides an information processing device and method. The information processing device comprises a setting unit, an acquisition unit, a processing unit and a first calculation unit, wherein the setting unit is used for receiving a setting command and setting the total amount and the number of red envelopes; the acquisition unit is used for acquiring n-1 random numbers between 0 and 1, wherein n refers to the number of the red envelopes; the processing unit is used for processing 0, 1 and the n-1 random numbers according to a preset algorithm to obtain n allocation proportion numbers; the first calculation unit is used for calculating the allocation amount of the n red envelopes according to the n allocation proportion numbers and the total amount of the red envelopes. Through the technical scheme, a new red envelope amount allocation algorithm is put forward, so that the allocation amount of the red envelopes is completely random, and meanwhile server pressure generated at the moment of red envelope snatching is lowered.
Description
Technical field
The present invention relates to technical field of information processing, in particular to a kind of information processor and
Information processing method.
Background technology
At present, with the development of mobile Internet, it is all kinds of rob red packet game emerge in an endless stream, become businessman
Inhale powder, strengthen the sharp weapon of user's viscosity.
However, the red packet amount of money allocation algorithm in correlation technique is existed robs red packet instant service device pressure
Greatly, the distribution amount of money of red packet not exclusively random, red packet such as is distributed in advance at the problems.
Therefore, the distribution amount of money completely random of red packet how is caused, while reducing robbing the clothes of red packet moment
Business device pressure becomes current problem demanding prompt solution.
The content of the invention
The present invention is based on the problems referred to above, it is proposed that a kind of new technical scheme, a kind of by proposing
The algorithm of the new distribution red packet amount of money so that the distribution amount of money completely random of red packet, while reduce robbing
The server stress of red packet moment.
In view of this, a first aspect of the present invention proposes a kind of information processor, including:Arrange
Unit, for receiving instruction is arranged, and arranges red packet total amount and red packet quantity;Acquiring unit, is used for
The n-1 random number between 0 to 1 is obtained, wherein, n represents the red packet quantity;Process single
Unit, for processing 0,1 and n-1 random number according to preset algorithm, obtains n
Individual distribution ratio number of cases;First computing unit, for according to the n distribution ratio number of cases and the red packet
Total amount calculates the distribution amount of money of n red packet.
In the technical scheme, 0,1 and n-1 random number are processed according to preset algorithm,
N distribution ratio number of cases of n red packet is obtained, n distribution ratio number of cases is multiplied with red packet total amount,
The distribution amount of money of n red packet is obtained, therefore, by above-mentioned technical proposal, due to obtain 0 to
Random number completely random between 1 so that the distribution ratio number of cases tried to achieve according to preset algorithm also completely with
Machine, so as to ensure that the distribution amount of money completely random of red packet.And, precalculate dividing for each red packet
With the amount of money, when the request for robbing red packet is received, the distribution amount of money of each red packet of storage is carried successively
Take out, complete red packet granting, the server stress for robbing red packet moment can be significantly reduced.
In above-mentioned technical proposal, it is preferable that the processing unit includes:Sequencing unit, for inciting somebody to action
0th, 1 and n-1 random number is ranked up;The processing unit is specifically for calculating sequence
The first difference in 0,1 and n-1 random number afterwards between every two neighboring number, will count
N first difference for obtaining is used as the n distribution ratio number of cases.
In the technical scheme, by the way that 0,1 and n-1 random number are ranked up, and calculate
Per the first difference between two neighboring number in 0,1 and n-1 random number after sequence, this
One difference is distribution ratio number of cases, and for example, red packet quantity is 5 (i.e. n=5), is taken in 0 to 1
4 random numbers and by 0,1 and 4 random number according to order from small to large be ranked up gained
(wherein, 0.2,0.4,0.5,0.9 is 0 to 1 to be combined into { 0,0.2,0.4,0.5,0.9,1 } to collection
In 4 random numbers), calculate in above-mentioned set and be obtained per the first difference between adjacent two numbers
5 distribution ratio number of cases:0.2、0.2、0.1、0.4、0.1.Due to above-mentioned calculating red packet distribution ratio number of cases
Algorithm it is succinct, therefore, it can relatively quickly obtain distribution ratio number of cases, and setting up red packet
The distribution amount of money of n red packet is calculated after total amount and red packet quantity so that (many in high concurrent
When user robs red packet) can quick returning result, significantly reduce the pressure of server.Preferably,
N-1 random number is different, and so calculated n distribution ratio number of cases is also different, i.e.,
The distribution amount of money of n red packet will not be 0, also allow for being got when red packet is robbed the use of red packet per family
Certain red packet amount of money can be obtained, is not in the situation that the red packet amount of money got of user is 0, also not
The situation that red packet is distributed in advance occurs.
In any of the above-described technical scheme, it is preferable that also include:Judging unit, it is described for judging
Whether the distribution amount of money sum of n red packet is equal with the red packet total amount;Adjustment unit, if for
Judge that the distribution amount of money sum of the n red packet is unequal with the red packet total amount, to the n
The distribution amount of money of red packet is adjusted so that adjustment after the n red packet distribution amount of money sum and
The red packet total amount is equal.
In the technical scheme, due to can be because of rounding up when the distribution amount of money of n red packet is calculated
The reason for cause the distribution amount of money sum of n red packet and red packet total amount, therefore, when judging n
When the distribution amount of money sum of individual red packet is unequal with red packet total amount, by the allotment money to n red packet
Volume is adjusted, so that the distribution amount of money sum of n red packet after adjustment is equal with red packet total amount,
Thus, the distribution amount of money sum for avoiding n red packet in red packet assigning process is overflowed or discontented situation,
Ensure that the distribution amount of money validity of red packet.
In any of the above-described technical scheme, it is preferable that the adjustment unit includes:Second computing unit,
For calculating the second difference between the distribution amount of money sum of the n red packet and the red packet total amount;
The adjustment unit is specifically for if second difference is positive number, according to preset cost institute being reduced
The distribution amount of money of n red packet is stated, if second difference is negative, according to preset cost institute is increased
State the distribution amount of money of n red packet.
In the technical scheme, by calculate n red packet distribution amount of money sum and red packet total amount it
Between the second difference, if the second difference is positive number, i.e., the distribution amount of money sum of n red packet is more than red packet
Total amount, then reduce the distribution amount of money of n red packet according to preset cost (such as 1 point of), and if the
Two differences are negative, i.e., the distribution amount of money sum of n red packet is less than red packet total amount, then according to default
The amount of money increases the distribution amount of money of n red packet.
Preferably, in the distribution amount of money according to preset cost n red packet of reduction, reduce by a red packet
Distribution the amount of money after judge whether the distribution amount of money sum of a n red packet equal with red packet total amount,
If equal, stop reducing, otherwise continue the distribution amount of money that next red packet is reduced according to preset cost,
Until the distribution amount of money sum of n red packet is equal with red packet total amount, likewise, according to default gold
During the distribution amount of money of volume n red packet of increase, also carry out according to above-mentioned steps.
In any of the above-described technical scheme, it is preferable that also include:Storage unit, for by the n
The distribution amount of money of individual red packet is stored in internal memory storehouse;The acquiring unit is additionally operable to, described sending
Directly obtain the distribution amount of money of the n red packet during n red packet successively from the internal memory storehouse.
In the technical scheme, by the way that the distribution amount of money of n red packet is stored in internal memory storehouse,
User directly can successively obtain the distribution amount of money of n red packet from internal memory storehouse when robbing red packet, effectively
Improve when user robs red packet obtain red packet distribution the amount of money efficiency, so as to improve user's body
Test.
A second aspect of the present invention proposes a kind of information processing method, including:Setting unit is received and set
Instruction is put, red packet total amount and red packet quantity are set;Acquiring unit obtains n-1 between 0 to 1
Random number, wherein, n represents the red packet quantity;Processing unit is according to preset algorithm to 0,1
And the n-1 random number is processed, and obtains n distribution ratio number of cases;First computing unit root
The distribution amount of money of n red packet is calculated according to the n distribution ratio number of cases and the red packet total amount.
In the technical scheme, 0,1 and n-1 random number are processed according to preset algorithm,
N distribution ratio number of cases of n red packet is obtained, n distribution ratio number of cases is multiplied with red packet total amount,
The distribution amount of money of n red packet is obtained, therefore, by above-mentioned technical proposal, due to obtain 0 to
Random number completely random between 1 so that the distribution ratio number of cases tried to achieve according to preset algorithm also completely with
Machine, so as to ensure that the distribution amount of money completely random of red packet.And, precalculate dividing for each red packet
With the amount of money, when the request for robbing red packet is received, the distribution amount of money of each red packet of storage is carried successively
Take out, complete red packet granting, the server stress for robbing red packet moment can be significantly reduced.
In any of the above-described technical scheme, it is preferable that the processing unit according to preset algorithm to 0,
1 and n-1 random number is processed, and the step of obtain n distribution ratio number of cases, is specifically wrapped
Include:Sequencing unit is ranked up 0,1 and n-1 random number;The processing unit meter
The first difference between every two neighboring number in 0,1 and n-1 random number after sequence is calculated,
Using calculated n first difference as the n distribution ratio number of cases.
In the technical scheme, by the way that 0,1 and n-1 random number are ranked up, and calculate
Per the first difference between two neighboring number in 0,1 and n-1 random number after sequence, this
One difference is distribution ratio number of cases, and for example, red packet quantity is 5 (i.e. n=5), is taken in 0 to 1
4 random numbers and by 0,1 and 4 random number according to order from small to large be ranked up gained
(wherein, 0.2,0.4,0.5,0.9 is 0 to 1 to be combined into { 0,0.2,0.4,0.5,0.9,1 } to collection
In 4 random numbers), calculate in above-mentioned set and be obtained per the first difference between adjacent two numbers
5 distribution ratio number of cases:0.2、0.2、0.1、0.4、0.1.Due to above-mentioned calculating red packet distribution ratio number of cases
Algorithm it is succinct, therefore, it can relatively quickly obtain distribution ratio number of cases, and setting up red packet
The distribution amount of money of n red packet is calculated after total amount and red packet quantity so that (many in high concurrent
When user robs red packet) can quick returning result, significantly reduce the pressure of server.Preferably,
N-1 random number is different, and so calculated n distribution ratio number of cases is also different, i.e.,
The distribution amount of money of n red packet will not be 0, also allow for being got when red packet is robbed the use of red packet per family
Certain red packet amount of money can be obtained, is not in the situation that the red packet amount of money got of user is 0, also not
The situation that red packet is distributed in advance occurs.
In any of the above-described technical scheme, it is preferable that first computing unit is according to the n point
After the step of distribution amount of money with proportional numbers and red packet total amount n red packet of calculating, also include:
Judging unit judges whether the distribution amount of money sum of the n red packet is equal with the red packet total amount;
If it is determined that the distribution amount of money sum of the n red packet is unequal with the red packet total amount, adjustment unit
The distribution amount of money of the n red packet is adjusted, so that the distribution of the n red packet after adjustment
Amount of money sum is equal with the red packet total amount.
In the technical scheme, due to can be because of rounding up when the distribution amount of money of n red packet is calculated
The reason for cause the distribution amount of money sum of n red packet and red packet total amount, therefore, when judging n
When the distribution amount of money sum of individual red packet is unequal with red packet total amount, by the allotment money to n red packet
Volume is adjusted, so that the distribution amount of money sum of n red packet after adjustment is equal with red packet total amount,
Thus, the distribution amount of money sum for avoiding n red packet in red packet assigning process is overflowed or discontented situation,
Ensure that the distribution amount of money validity of red packet.
In any of the above-described technical scheme, it is preferable that the adjustment unit divides the n red packet
The step of being adjusted with the amount of money, specifically includes:Second computing unit calculates dividing for the n red packet
With the second difference between amount of money sum and the red packet total amount;If second difference is positive number,
Then the adjustment unit reduces the distribution amount of money of the n red packet according to preset cost;If described second
Difference is negative, then the adjustment unit increases the distribution amount of money of the n red packet according to preset cost.
In the technical scheme, by calculate n red packet distribution amount of money sum and red packet total amount it
Between the second difference, if the second difference is positive number, i.e., the distribution amount of money sum of n red packet is more than red packet
Total amount, then reduce the distribution amount of money of n red packet according to preset cost (such as 1 point of), and if the
Two differences are negative, i.e., the distribution amount of money sum of n red packet is less than red packet total amount, then according to default
The amount of money increases the distribution amount of money of n red packet.
Preferably, in the distribution amount of money according to preset cost n red packet of reduction, reduce by a red packet
Distribution the amount of money after judge whether the distribution amount of money sum of a n red packet equal with red packet total amount,
If equal, stop reducing, otherwise continue the distribution amount of money that next red packet is reduced according to preset cost,
Until the distribution amount of money sum of n red packet is equal with red packet total amount, likewise, according to default gold
During the distribution amount of money of volume n red packet of increase, also carry out according to above-mentioned steps.
In any of the above-described technical scheme, it is preferable that first computing unit is according to the n point
After the step of distribution amount of money with proportional numbers and red packet total amount n red packet of calculating, also include:
Storage unit is stored in the distribution amount of money of the n red packet in internal memory storehouse;The acquiring unit,
Directly obtain dividing for the n red packet successively from the internal memory storehouse when the n red packet is sent
With the amount of money.
In the technical scheme, by the way that the distribution amount of money of n red packet is stored in internal memory storehouse,
User directly can successively obtain the distribution amount of money of n red packet from internal memory storehouse when robbing red packet, effectively
Improve when user robs red packet obtain red packet distribution the amount of money efficiency, so as to improve user's body
Test.
By technical scheme, by proposing a kind of algorithm of the new distribution red packet amount of money, make
The distribution amount of money completely random of red packet is obtained, while reducing the server stress for robbing red packet moment.
Description of the drawings
Fig. 1 shows the structural representation of information processor according to an embodiment of the invention;
Fig. 2 shows the structural representation of information processor according to another embodiment of the invention;
Fig. 3 shows the schematic flow sheet of information processing method according to an embodiment of the invention.
Specific embodiment
In order to the above objects, features and advantages of the present invention can be more clearly understood that, with reference to attached
Figure and specific embodiment are further described in detail to the present invention.It should be noted that not
In the case of conflict, the feature in embodiments herein and embodiment can be mutually combined.
Many details are elaborated in the following description in order to fully understand the present invention, but,
The present invention can also be different from other modes described here to implement using other, therefore, the present invention
Protection domain do not limited by following public specific embodiment.
Fig. 1 shows the structural representation of information processor according to an embodiment of the invention.
As shown in figure 1, information processor according to an embodiment of the invention 100, including:
Setting unit 102, acquiring unit 104, the computing unit 108 of processing unit 106 and first, wherein,
The setting unit 102, for receiving instruction is arranged, and arranges red packet total amount and red packet quantity;Institute
Acquiring unit 104 is stated, for obtaining the n-1 random number between 0 to 1, wherein, n is represented
The red packet quantity;The processing unit 106, for individual to 0,1 and n-1 according to preset algorithm
The random number is processed, and obtains n distribution ratio number of cases;First computing unit 108, uses
In the distribution amount of money that n red packet is calculated according to the n distribution ratio number of cases and the red packet total amount.
In the technical scheme, 0,1 and n-1 random number are processed according to preset algorithm,
N distribution ratio number of cases of n red packet is obtained, n distribution ratio number of cases is multiplied with red packet total amount,
The distribution amount of money of n red packet is obtained, therefore, by above-mentioned technical proposal, due to obtain 0 to
Random number completely random between 1 so that the distribution ratio number of cases tried to achieve according to preset algorithm also completely with
Machine, so as to ensure that the distribution amount of money completely random of red packet.And, precalculate dividing for each red packet
With the amount of money, when the request for robbing red packet is received, the distribution amount of money of each red packet of storage is carried successively
Take out, complete red packet granting, the server stress for robbing red packet moment can be significantly reduced.
In above-mentioned technical proposal, it is preferable that the processing unit 106 includes:Sequencing unit
1062, for 0,1 and n-1 random number to be ranked up;The processing unit 106
Specifically for, calculate in 0,1 and n-1 random number after sequence per it is two neighboring it is several it
Between the first difference, using calculated n first differences as the n distribution ratio number of cases.
In the technical scheme, by the way that 0,1 and n-1 random number are ranked up, and calculate
Per the first difference between two neighboring number in 0,1 and n-1 random number after sequence, this
One difference is distribution ratio number of cases, and for example, red packet quantity is 5 (i.e. n=5), is taken in 0 to 1
4 random numbers and by 0,1 and 4 random number according to order from small to large be ranked up gained
(wherein, 0.2,0.4,0.5,0.9 is 0 to 1 to be combined into { 0,0.2,0.4,0.5,0.9,1 } to collection
In 4 random numbers), calculate in above-mentioned set and be obtained per the first difference between adjacent two numbers
5 distribution ratio number of cases:0.2、0.2、0.1、0.4、0.1.Due to above-mentioned calculating red packet distribution ratio number of cases
Algorithm it is succinct, therefore, it can relatively quickly obtain distribution ratio number of cases, and setting up red packet
The distribution amount of money of n red packet is calculated after total amount and red packet quantity so that (many in high concurrent
When user robs red packet) can quick returning result, significantly reduce the pressure of server.Preferably,
N-1 random number is different, and so calculated n distribution ratio number of cases is also different, i.e.,
The distribution amount of money of n red packet will not be 0, also allow for being got when red packet is robbed the use of red packet per family
Certain red packet amount of money can be obtained, is not in the situation that the red packet amount of money got of user is 0, also not
The situation that red packet is distributed in advance occurs.
In any of the above-described technical scheme, it is preferable that also include:Judging unit 110, for judging
Whether the distribution amount of money sum of the n red packet is equal with the red packet total amount;Adjustment unit 112,
For if it is determined that the distribution amount of money sum of the n red packet is unequal with the red packet total amount, to institute
The distribution amount of money for stating n red packet is adjusted, so that the distribution amount of money of the n red packet after adjustment
Sum is equal with the red packet total amount.
In the technical scheme, due to can be because of rounding up when the distribution amount of money of n red packet is calculated
The reason for cause the distribution amount of money sum of n red packet and red packet total amount, therefore, when judging n
When the distribution amount of money sum of individual red packet is unequal with red packet total amount, by the allotment money to n red packet
Volume is adjusted, so that the distribution amount of money sum of n red packet after adjustment is equal with red packet total amount,
Thus, the distribution amount of money sum for avoiding n red packet in red packet assigning process is overflowed or discontented situation,
Ensure that the distribution amount of money validity of red packet.
In any of the above-described technical scheme, it is preferable that the adjustment unit 112 includes:Second calculates
Unit 1122, for calculate the n red packet distribution amount of money sum and the red packet total amount it
Between the second difference;The adjustment unit 112 specifically for, if second difference be positive number,
The distribution amount of money of the n red packet is reduced according to preset cost, if second difference is negative,
Increase the distribution amount of money of the n red packet according to preset cost.
In the technical scheme, by calculate n red packet distribution amount of money sum and red packet total amount it
Between the second difference, if the second difference is positive number, i.e., the distribution amount of money sum of n red packet is more than red packet
Total amount, then reduce the distribution amount of money of n red packet according to preset cost (such as 1 point of), and if the
Two differences are negative, i.e., the distribution amount of money sum of n red packet is less than red packet total amount, then according to default
The amount of money increases the distribution amount of money of n red packet.
Preferably, in the distribution amount of money according to preset cost n red packet of reduction, reduce by a red packet
Distribution the amount of money after judge whether the distribution amount of money sum of a n red packet equal with red packet total amount,
If equal, stop reducing, otherwise continue the distribution amount of money that next red packet is reduced according to preset cost,
Until the distribution amount of money sum of n red packet is equal with red packet total amount, likewise, according to default gold
During the distribution amount of money of volume n red packet of increase, also carry out according to above-mentioned steps.
In any of the above-described technical scheme, it is preferable that also include:Storage unit 114, for by institute
The distribution amount of money for stating n red packet is stored in internal memory storehouse;The acquiring unit 104 is additionally operable to,
Directly obtain the distribution of the n red packet when sending the n red packet successively from the internal memory storehouse
The amount of money.
In the technical scheme, by the way that the distribution amount of money of n red packet is stored in internal memory storehouse,
User directly can successively obtain the distribution amount of money of n red packet from internal memory storehouse when robbing red packet, effectively
Improve when user robs red packet obtain red packet distribution the amount of money efficiency, so as to improve user's body
Test.
Fig. 2 shows the structural representation of information processor according to another embodiment of the invention.
As shown in Fig. 2 information processor 200 according to another embodiment of the invention, including:
Red packet parameter design unit 202, allocative decision is obtained and memory cell 204, red packet issuing unit
206 and provide monitoring unit 208, wherein, the red packet parameter design unit 202, for storing
The basic parameter information of red packet is provided, including:Red packet total amount, red packet quantity, granting red packet time;
The allocative decision is obtained and memory cell 204, for according to red packet total amount and red packet quantity, and
The distribution amount of money of each red packet is precalculated with reference to preset algorithm and store;The red packet issuing unit
206, for completing the granting of red packet, when the request for robbing red packet is received, each by storage is red
The distribution amount of money of bag is extracted successively, completes red packet granting;The granting monitoring unit 208, uses
In monitoring red packet procedure, can on request return and send out the amount of money, do not send out the amount of money, provide detailed (sending out
Put time, user, the amount of money).
Fig. 3 shows the schematic flow sheet of information processing method according to an embodiment of the invention.
As shown in figure 3, information processing method according to an embodiment of the invention, including:
Step 302, setting unit is received and arranges instruction, arranges red packet total amount and red packet quantity;
Step 304, acquiring unit obtains the n-1 random number between 0 to 1, wherein, n tables
Show the red packet quantity;
Step 306, processing unit is carried out according to preset algorithm to 0,1 and n-1 random number
Process, obtain n distribution ratio number of cases;
Step 308, the first computing unit is according to the n distribution ratio number of cases and the red packet total amount
Calculate the distribution amount of money of n red packet.
In the technical scheme, 0,1 and n-1 random number are processed according to preset algorithm,
N distribution ratio number of cases of n red packet is obtained, n distribution ratio number of cases is multiplied with red packet total amount,
The distribution amount of money of n red packet is obtained, therefore, by above-mentioned technical proposal, due to obtain 0 to
Random number completely random between 1 so that the distribution ratio number of cases tried to achieve according to preset algorithm also completely with
Machine, so as to ensure that the distribution amount of money completely random of red packet.And, precalculate dividing for each red packet
With the amount of money, when the request for robbing red packet is received, the distribution amount of money of each red packet of storage is carried successively
Take out, complete red packet granting, the server stress for robbing red packet moment can be significantly reduced.
In any of the above-described technical scheme, it is preferable that step 306 is specifically included:Sequencing unit by 0,
1 and n-1 random number is ranked up;The processing unit calculate 0,1 after sequence and
The first difference in the n-1 random number between every two neighboring number, by calculated n institute
The first difference is stated as the n distribution ratio number of cases.
In the technical scheme, by the way that 0,1 and n-1 random number are ranked up, and calculate
Per the first difference between two neighboring number in 0,1 and n-1 random number after sequence, this
One difference is distribution ratio number of cases, and for example, red packet quantity is 5 (i.e. n=5), is taken in 0 to 1
4 random numbers and by 0,1 and 4 random number according to order from small to large be ranked up gained
(wherein, 0.2,0.4,0.5,0.9 is 0 to 1 to be combined into { 0,0.2,0.4,0.5,0.9,1 } to collection
In 4 random numbers), calculate in above-mentioned set and be obtained per the first difference between adjacent two numbers
5 distribution ratio number of cases:0.2、0.2、0.1、0.4、0.1.Due to above-mentioned calculating red packet distribution ratio number of cases
Algorithm it is succinct, therefore, it can relatively quickly obtain distribution ratio number of cases, and setting up red packet
The distribution amount of money of n red packet is calculated after total amount and red packet quantity so that (many in high concurrent
When user robs red packet) can quick returning result, significantly reduce the pressure of server.Preferably,
N-1 random number is different, and so calculated n distribution ratio number of cases is also different, i.e.,
The distribution amount of money of n red packet will not be 0, also allow for being got when red packet is robbed the use of red packet per family
Certain red packet amount of money can be obtained, is not in the situation that the red packet amount of money got of user is 0, also not
The situation that red packet is distributed in advance occurs.
In any of the above-described technical scheme, it is preferable that after step 308, also include:Judging unit
Judge whether the distribution amount of money sum of the n red packet is equal with the red packet total amount;If it is determined that institute
The distribution amount of money sum for stating n red packet is unequal with the red packet total amount, and adjustment unit is to the n
The distribution amount of money of individual red packet is adjusted, so that the distribution amount of money sum of the n red packet after adjustment
It is equal with the red packet total amount.
In the technical scheme, due to can be because of rounding up when the distribution amount of money of n red packet is calculated
The reason for cause the distribution amount of money sum of n red packet and red packet total amount, therefore, when judging n
When the distribution amount of money sum of individual red packet is unequal with red packet total amount, by the allotment money to n red packet
Volume is adjusted, so that the distribution amount of money sum of n red packet after adjustment is equal with red packet total amount,
Thus, the distribution amount of money sum for avoiding n red packet in red packet assigning process is overflowed or discontented situation,
Ensure that the distribution amount of money validity of red packet.
In any of the above-described technical scheme, it is preferable that the adjustment unit divides the n red packet
The step of being adjusted with the amount of money, specifically includes:Second computing unit calculates dividing for the n red packet
With the second difference between amount of money sum and the red packet total amount;If second difference is positive number,
Then the adjustment unit reduces the distribution amount of money of the n red packet according to preset cost;If described second
Difference is negative, then the adjustment unit increases the distribution amount of money of the n red packet according to preset cost.
In the technical scheme, by calculate n red packet distribution amount of money sum and red packet total amount it
Between the second difference, if the second difference is positive number, i.e., the distribution amount of money sum of n red packet is more than red packet
Total amount, then reduce the distribution amount of money of n red packet according to preset cost (such as 1 point of), and if the
Two differences are negative, i.e., the distribution amount of money sum of n red packet is less than red packet total amount, then according to default
The amount of money increases the distribution amount of money of n red packet.
Preferably, in the distribution amount of money according to preset cost n red packet of reduction, reduce by a red packet
Distribution the amount of money after judge whether the distribution amount of money sum of a n red packet equal with red packet total amount,
If equal, stop reducing, otherwise continue the distribution amount of money that next red packet is reduced according to preset cost,
Until the distribution amount of money sum of n red packet is equal with red packet total amount, likewise, according to default gold
During the distribution amount of money of volume n red packet of increase, also carry out according to above-mentioned steps.
In any of the above-described technical scheme, it is preferable that after step 308, also include:Storage unit
The distribution amount of money of the n red packet is stored in internal memory storehouse;The acquiring unit, is sending institute
Directly obtain the distribution amount of money of the n red packet when stating n red packet successively from the internal memory storehouse.
In the technical scheme, by the way that the distribution amount of money of n red packet is stored in internal memory storehouse,
User directly can successively obtain the distribution amount of money of n red packet from internal memory storehouse when robbing red packet, effectively
Improve when user robs red packet obtain red packet distribution the amount of money efficiency, so as to improve user's body
Test.
Technical scheme is described in detail above in association with accompanying drawing, by proposing a kind of new distribution
The algorithm of the red packet amount of money so that the distribution amount of money completely random of red packet, while reduce robbing red packet moment
Server stress.
The preferred embodiments of the present invention are the foregoing is only, the present invention is not limited to, for
For those skilled in the art, the present invention can have various modifications and variations.All essences in the present invention
Within god and principle, any modification, equivalent substitution and improvements made etc. should be included in the present invention
Protection domain within.
Claims (10)
1. a kind of information processor, it is characterised in that include:
Setting unit, for receiving instruction is arranged, and arranges red packet total amount and red packet quantity;
Acquiring unit, for obtaining the n-1 random number between 0 to 1, wherein, n represents institute
State red packet quantity;
Processing unit, at according to preset algorithm to 0,1 and n-1 random number
Reason, obtains n distribution ratio number of cases;
First computing unit, for being calculated according to the n distribution ratio number of cases and the red packet total amount
The distribution amount of money of n red packet.
2. information processor according to claim 1, it is characterised in that the process list
Unit includes:
Sequencing unit, for 0,1 and n-1 random number to be ranked up;
The processing unit is specifically for calculating 0,1 and n-1 random number after sequence
In per the first difference between two neighboring number, using calculated n first difference as institute
State n distribution ratio number of cases.
3. information processor according to claim 1, it is characterised in that also include:
Judging unit, for judging the distribution amount of money sum and the red packet total amount of the n red packet
It is whether equal;
Adjustment unit, for if it is determined that the distribution amount of money sum of the n red packet is always golden with the red packet
Volume is unequal, and the distribution amount of money of the n red packet is adjusted, so that the n after adjustment
The distribution amount of money sum of red packet is equal with the red packet total amount.
4. information processor according to claim 2, it is characterised in that the adjustment list
Unit includes:
Second computing unit, the distribution amount of money sum for calculating the n red packet is total with the red packet
The second difference between the amount of money;
The adjustment unit according to preset cost specifically for if second difference is positive number, subtracting
The distribution amount of money of few n red packet, if second difference is negative, increases according to preset cost
Plus the distribution amount of money of the n red packet.
5. information processor according to any one of claim 1 to 4, it is characterised in that
Also include:
Storage unit, for the distribution amount of money of the n red packet to be stored in internal memory storehouse;
The acquiring unit is additionally operable to, when the n red packet is sent directly from the internal memory storehouse
The distribution amount of money of the n red packet is obtained successively.
6. a kind of information processing method, it is characterised in that include:
Setting unit is received and arranges instruction, arranges red packet total amount and red packet quantity;
Acquiring unit obtains the n-1 random number between 0 to 1, wherein, n represents the red packet
Quantity;
Processing unit is processed 0,1 and n-1 random number according to preset algorithm, is obtained
To n distribution ratio number of cases;
It is individual red that first computing unit calculates n according to the n distribution ratio number of cases and the red packet total amount
The distribution amount of money of bag.
7. information processing method according to claim 6, it is characterised in that the process list
Unit is processed 0,1 and n-1 random number according to preset algorithm, obtains n distribution
The step of proportional numbers, specifically include:
Sequencing unit is ranked up 0,1 and n-1 random number;
The processing unit is calculated in 0,1 and n-1 random number after sequence per adjacent two
The first difference between number, using calculated n first difference as described n distribution
Proportional numbers.
8. information processing method according to claim 6, it is characterised in that first meter
Calculate the allotment money that unit calculates n red packet according to the n distribution ratio number of cases and the red packet total amount
After the step of volume, also include:
Judging unit judges the distribution amount of money sum of the n red packet and the red packet total amount whether phase
Deng;
If it is determined that the distribution amount of money sum of the n red packet is unequal with the red packet total amount, adjustment
Unit is adjusted to the distribution amount of money of the n red packet, so that the n red packet after adjustment
Distribution amount of money sum is equal with the red packet total amount.
9. information processing method according to claim 8, it is characterised in that the adjustment list
The step of unit is adjusted to the distribution amount of money of the n red packet, specifically includes:
Second computing unit calculate the n red packet distribution amount of money sum and the red packet total amount it
Between the second difference;
If second difference is positive number, the adjustment unit reduces described n according to preset cost
The distribution amount of money of red packet;
If second difference is negative, the adjustment unit increases described n according to preset cost
The distribution amount of money of red packet.
10. the information processing method according to any one of claim 6 to 9, it is characterised in that
It is individual red that first computing unit calculates n according to the n distribution ratio number of cases and the red packet total amount
After the step of distribution amount of money of bag, also include:
Storage unit is stored in the distribution amount of money of the n red packet in internal memory storehouse;
The acquiring unit, directly obtains successively when the n red packet is sent from the internal memory storehouse
Take the distribution amount of money of the n red packet.
Priority Applications (1)
Application Number | Priority Date | Filing Date | Title |
---|---|---|---|
CN201510698435.2A CN106611309A (en) | 2015-10-23 | 2015-10-23 | Information processing device and method |
Applications Claiming Priority (1)
Application Number | Priority Date | Filing Date | Title |
---|---|---|---|
CN201510698435.2A CN106611309A (en) | 2015-10-23 | 2015-10-23 | Information processing device and method |
Publications (1)
Publication Number | Publication Date |
---|---|
CN106611309A true CN106611309A (en) | 2017-05-03 |
Family
ID=58612136
Family Applications (1)
Application Number | Title | Priority Date | Filing Date |
---|---|---|---|
CN201510698435.2A Pending CN106611309A (en) | 2015-10-23 | 2015-10-23 | Information processing device and method |
Country Status (1)
Country | Link |
---|---|
CN (1) | CN106611309A (en) |
Cited By (1)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
WO2019047774A1 (en) * | 2017-09-06 | 2019-03-14 | 阿里巴巴集团控股有限公司 | Resource allocation method and device and electronic device |
-
2015
- 2015-10-23 CN CN201510698435.2A patent/CN106611309A/en active Pending
Cited By (2)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
WO2019047774A1 (en) * | 2017-09-06 | 2019-03-14 | 阿里巴巴集团控股有限公司 | Resource allocation method and device and electronic device |
TWI682336B (en) * | 2017-09-06 | 2020-01-11 | 香港商阿里巴巴集團服務有限公司 | Resource allocation method and device and electronic equipment |
Similar Documents
Publication | Publication Date | Title |
---|---|---|
CN104025690B (en) | It is a kind of to adjust the method and user equipment for sending the time | |
JP2011528473A5 (en) | ||
CN103729236B (en) | A kind of method for limiting cloud computing user resources using amount | |
CN104504567B (en) | A kind of recharge method and device of small amount payment card | |
CN108615151A (en) | Data processing method, block chain server and node device | |
CN107248070A (en) | The method and device for group's pre-paid of chatting | |
CN108123839B (en) | Message sending method, device, server and storage medium | |
CN106611309A (en) | Information processing device and method | |
CN108899015A (en) | Computer readable recording medium and computer equipment | |
JP2017533644A5 (en) | ||
TW200515220A (en) | Method for providing imaging substance for use in an imaging device via a virtual replenishment | |
CN108055328A (en) | Provide the method and device of electronics red packet | |
CN105224450B (en) | Concurrent testing method and device | |
WO2014070242A3 (en) | Systems and methods for providing digital bundles of services | |
WO2018040921A1 (en) | Random number generation method and device utilized in computer system | |
CN104484902A (en) | Cloud-based car-sharing cost calculating and processing method | |
CN105511956B (en) | A kind of method for scheduling task and system based on shared scheduling information | |
CN104079566B (en) | The computational methods of result property value in terminal, server and the page | |
CN107346582B (en) | A kind of equilibrium note output algorithm | |
CN106327273A (en) | STS-based prepaid electricity selling system and method | |
CN108009809A (en) | Electronics red packet distribution method and device based on position and time | |
WO2019162589A3 (en) | Allocation method and device for dividing the sum of a bank transaction between a plurality of users | |
CN109395380A (en) | Game data processing method and system, server and computer readable storage medium | |
CN103544292B (en) | Diameter message processing method and device based on HASH table | |
CN108804670A (en) | Data recommendation method, device, computer equipment and storage medium |
Legal Events
Date | Code | Title | Description |
---|---|---|---|
PB01 | Publication | ||
PB01 | Publication | ||
SE01 | Entry into force of request for substantive examination | ||
SE01 | Entry into force of request for substantive examination | ||
RJ01 | Rejection of invention patent application after publication |
Application publication date: 20170503 |
|
RJ01 | Rejection of invention patent application after publication |