Resource allocation method and device, resource allocation equipment and storage medium

By setting the user database and controlling the allocation number in the resource allocation device, the problem of how to allocate network resources when the number of users is unknown is solved, ensuring the controllability of the number of resources collected by users, and improving the controllability of publicity activities and User experience.

CN118972438AActive Publication Date: 2024-11-15CHINA TELECOM CORP LTD
View PDF 8 Cites 0 Cited by

Patent Information

Application Number
CN202410962550.5
Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
Filing Date
2024-07-17
Publication Date
2024-11-15
Estimated Expiration
2044-07-17

AI Technical Summary

Technical Problem

In the case where the number of users is unknown, it is difficult to ensure the number of attempts and successes for users to effectively allocate network resources, especially in scenarios where users need to control the collection of specific types of resource sequences, such as promotional activities.

Method used

By setting up a user database in the resource allocation device, recording the types and quantities of resources that the user has allocated, randomly generate and allocate network resources according to the set probability and allocation times, controlling the allocation times of specific types of resources, ensuring that the number of resources collected by users is as follows: No more than the threshold.

Benefits of technology

It realizes that when the number of users is unknown, network resources are allocated to users to ensure that the number of resources collected by users in the event is within a predetermined range, and improves the controllability and user experience of the event.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN118972438A_ABST
    Figure CN118972438A_ABST
Patent Text Reader

Abstract

The embodiment of the invention discloses a resource allocation method, which is applied to resource allocation equipment, the resource allocation equipment can allocate N types of network resources, and the method comprises the following steps: receiving a first resource allocation request sent by a first user in a target scene; in response to the first resource allocation request, allocating a network resource to the first user according to the first probability, and recording the type information of the allocated network resource into a user database; according to a user database, determining whether the number of the first users of which the N types of network resources are gathered reaches a first number threshold value, and if yes, setting the number of distribution times of the network resources of the specific type in the N types of network resources; a second resource allocation request sent by the first user in the target scene is received, and the second resource allocation request is used for requesting to allocate one network resource; and in response to the second resource allocation request, allocating a network resource to the first user according to the set allocation times.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present application relates to the field of computer network technology, and in particular to a resource allocation method, apparatus, resource allocation device and storage medium. Background Art

[0002] With the rapid development of computer network technology, computers are becoming more and more popular, and network resources are becoming increasingly abundant, making the application of computers penetrate into all areas of society. Among them, network resources mainly refer to the sum of various information resources that can be used with the help of the network environment. These resources usually exist in the form of electronic resource data, including text, images, sounds, animations and other forms of information, stored in non-printed media such as optical and magnetic media. At the same time, with the continuous development of mobile Internet technology, the number of users of electronic devices such as smart phones and tablets is also increasing. When the number of users is unknown, how to allocate network resources to users has become a technical problem that technicians in this field need to solve urgently. Summary of the invention

[0003] The embodiments of the present application provide a resource allocation method, apparatus, resource allocation device and storage medium, which can allocate network resources to users when the number of users is unknown.

[0004] According to a first aspect of the present application, a resource allocation method is disclosed, which is applied to a resource allocation device, wherein the resource allocation device can allocate N types of network resources, where N is an integer greater than 1, and the method comprises:

[0005] Receiving a first resource allocation request sent by a first user in a target scenario, wherein the first resource allocation request is used to request allocation of a network resource;

[0006] In response to the first resource allocation request, a network resource is allocated to the first user according to a first probability, and type information of the network resource allocated to the first user is recorded in a user database, wherein the user database includes: the number of various network resources allocated to each of the first users and the type of each network resource, and the first probability is an artificially set probability that the first user collects all the N types of network resources;

[0007] Determine, according to the user database, whether the number of first users who have collected the N types of network resources reaches a first quantity threshold, and if so, set the number of allocations of a specific type of network resource among the N types of network resources;

[0008] receiving a second resource allocation request sent by a first user in the target scenario, wherein the second resource allocation request is used to request allocation of a network resource;

[0009] In response to the second resource allocation request, a network resource is allocated to the first user according to the set allocation number.

[0010] Optionally, as an embodiment, allocating a network resource to the first user according to the set allocation number includes:

[0011] Randomly generate a network resource according to the set allocation times and the second probability, wherein the second probability is an artificially set probability that the first user collects all the N types of network resources;

[0012] Determine, according to the user database and the type information of the randomly generated network resources, a third probability and a real allocation number of the specific type of network resources after the number of first users who have collected the N types of network resources reaches a first quantity threshold, wherein the third probability is a real probability that the first user collects the N types of network resources;

[0013] A network resource is allocated to the first user according to the second probability, the third probability, the set allocation times and the actual allocation times.

[0014] Optionally, as an embodiment, the number of types of the specific type of network resources is 1;

[0015] The allocating a network resource to the first user according to the second probability, the third probability, the set allocation times and the actual allocation times includes:

[0016] determining whether the third probability is less than or equal to the second probability;

[0017] If the third probability is less than or equal to the second probability, determining whether the actual number of allocations is less than or equal to the set number of allocations;

[0018] If the actual number of allocations is less than or equal to the set number of allocations, the randomly selected network resource is allocated to the first user, and the type information of the network resource allocated to the first user is recorded in the user database;

[0019] If the third probability is greater than the second probability, or the actual number of allocations is greater than the set number of allocations, the method returns to the step of randomly selecting a network resource according to the set number of allocations and the second probability.

[0020] Optionally, as an embodiment, the number of types of the specific type of network resources is M, where M is an integer greater than 1 and less than N;

[0021] The allocating a network resource to the first user according to the second probability, the third probability, the set allocation times and the actual allocation times includes:

[0022] determining whether the third probability is less than or equal to the second probability;

[0023] If the third probability is less than or equal to the second probability, determining whether the actual allocation times corresponding to each of the M specific types of network resources are all less than or equal to the set allocation times;

[0024] If all the actual allocation times are less than or equal to the set allocation times, allocating the randomly selected network resource to the first user, and recording the type information of the network resource allocated to the first user in the user database;

[0025] If the third probability is greater than the second probability, or at least one of the actual allocation times is greater than the set allocation times, the process returns to the step of randomly selecting a network resource according to the set allocation times and the second probability.

[0026] Optionally, as an embodiment, the resource allocation request is sent by the user through an electronic device used by the user, after the user scans a barcode in the target scene and triggers the electronic device to send the request to the resource allocation device.

[0027] Optionally, as an embodiment, the network resource includes any one of the following: image, text, video, audio.

[0028] Optionally, as an embodiment, the network resources include text; the N types of network resources include: N different specific texts; the target scenario is a scenario in which the N different specific texts are collected to exchange for gifts, and the first quantity threshold is the quantity value of gifts under the target scenario.

[0029] According to a second aspect of the present application, a resource allocation device is disclosed, which is applied to a resource allocation device, wherein the resource allocation device can allocate N types of network resources, where N is an integer greater than 1, and the device includes:

[0030] A first receiving module, configured to receive a first resource allocation request sent by a first user in a target scenario, wherein the first resource allocation request is used to request allocation of a network resource;

[0031] a first allocation module, configured to respond to the first resource allocation request, allocate a network resource to the first user according to a first probability, and record type information of the network resource allocated to the first user into a user database, wherein the user database includes: the number of various network resources allocated to each of the first users and the type of each network resource, and the first probability is an artificially set probability that the first user collects all of the N types of network resources;

[0032] A determination module, configured to determine, according to the user database, whether the number of first users who have collected the N types of network resources reaches a first number threshold;

[0033] A setting module, configured to set the number of allocations of a specific type of network resource among the N types of network resources when the number of first users who have collected the N types of network resources reaches a first number threshold;

[0034] A second receiving module, configured to receive a second resource allocation request sent by a first user in the target scenario, wherein the second resource allocation request is used to request allocation of a network resource;

[0035] The second allocation module is used to allocate a network resource to the first user according to a set allocation number in response to the second resource allocation request.

[0036] Optionally, as an embodiment, the second allocation module includes:

[0037] A generating submodule, configured to randomly generate a network resource according to a set number of allocations and a second probability, wherein the second probability is an artificially set probability that the first user collects all the N types of network resources;

[0038] a determination submodule, configured to determine, according to the user database and the type information of the randomly generated network resources, a third probability and a real allocation number of the specific type of network resources after the number of first users who have collected the N types of network resources reaches a first quantity threshold, wherein the third probability is a real probability that the first user has collected the N types of network resources;

[0039] An allocation submodule is used to allocate a network resource to the first user according to the second probability, the third probability, the set allocation number and the actual allocation number.

[0040] Optionally, as an embodiment, the number of types of the specific type of network resources is 1;

[0041] The allocation submodule comprises:

[0042] A first determining unit, configured to determine whether the third probability is less than or equal to the second probability;

[0043] a second determining unit, configured to determine whether the actual number of allocations is less than or equal to a set number of allocations if the third probability is less than or equal to the second probability;

[0044] a first allocation unit, configured to allocate the randomly selected network resource to the first user if the actual allocation number is less than or equal to the set allocation number, and record type information of the network resource allocated to the first user in a user database;

[0045] The first loop unit is used to return to the step of randomly selecting a network resource according to the set allocation number and the second probability if the third probability is greater than the second probability, or the actual allocation number is greater than the set allocation number.

[0046] Optionally, as an embodiment, the number of types of the specific type of network resources is M, where M is an integer greater than 1 and less than N;

[0047] The allocation submodule comprises:

[0048] a third determining unit, configured to determine whether the third probability is less than or equal to the second probability;

[0049] a fourth determining unit, configured to determine whether the actual allocation times corresponding to each of the M specific types of network resources are all less than or equal to the set allocation times if the third probability is less than or equal to the second probability;

[0050] a second allocation unit, configured to allocate the randomly selected network resource to the first user if all the actual allocation times are less than or equal to the set allocation times, and record the type information of the network resource allocated to the first user into a user database;

[0051] The second loop unit is used to return to the step of randomly selecting a network resource according to the set allocation number and the second probability if the third probability is greater than the second probability, or at least one of the actual allocation times is greater than the set allocation number.

[0052] Optionally, as an embodiment, the resource allocation request is sent by the user through an electronic device used by the user, after the user scans a barcode in the target scene and triggers the electronic device to send the request to the resource allocation device.

[0053] Optionally, as an embodiment, the network resource includes any one of the following: image, text, video, audio.

[0054] Optionally, as an embodiment, the network resources include text; the N types of network resources include: N different specific texts; the target scenario is a scenario in which the N different specific texts are collected to exchange for gifts, and the first quantity threshold is the quantity value of gifts under the target scenario.

[0055] According to a third aspect of the present application, a resource allocation device is disclosed, comprising a memory, a processor, and a computer program stored in the memory, wherein the processor executes the computer program to implement the resource allocation method in the first aspect.

[0056] According to a fourth aspect of the present application, a computer-readable storage medium is disclosed, on which a computer program / instruction is stored. When the computer program / instruction is executed by a processor, the resource allocation method in the first aspect is implemented.

[0057] According to a fifth aspect of the present application, a computer program product is disclosed, comprising a computer program / instruction, which implements the resource allocation method in the first aspect when executed by a processor.

[0058] In an embodiment of the present application, a resource allocation device receives a first resource allocation request sent by a first user in a target scenario, wherein the first resource allocation request is used to request allocation of a network resource; in response to the first resource allocation request, a network resource is allocated to the first user according to a first probability, and the type information of the network resource allocated to the first user is recorded in a user database, wherein the user database includes: the number of various network resources allocated to each first user and the type of each network resource, and the first probability is an artificially set probability that the first user has collected N types of network resources; according to the user database, it is determined whether the number of first users who have collected N types of network resources reaches a first quantity threshold, and if so, the number of allocations of a specific type of network resource among the N types of network resources is set; a second resource allocation request is received from the first user in the target scenario, wherein the second resource allocation request is used to request allocation of a network resource; in response to the second resource allocation request, a network resource is allocated to the first user according to the set number of allocations, thereby allocating network resources to users when the number of users is unknown. BRIEF DESCRIPTION OF THE DRAWINGS

[0059] In order to more clearly illustrate the embodiments of the present application or the technical solutions in the prior art, the drawings required for use in the embodiments or the description of the prior art will be briefly introduced below. Obviously, the drawings described below are only some embodiments of the present application. For ordinary technicians in this field, other drawings can be obtained based on these drawings without paying creative work.

[0060] Figure 1 is a flow chart of a resource allocation method provided in an embodiment of the present application;

[0061] Figure 2 This is an application scenario diagram of a resource allocation method provided in an embodiment of the present application;

[0062] Figure 3 is a flowchart of an implementation of step 105 provided in an embodiment of the present application;

[0063] Figure 4 This is one of the flowcharts of an implementation of step 303 provided in an embodiment of the present application;

[0064] Figure 5 This is a second flowchart of an implementation method of step 303 provided in an embodiment of the present application;

[0065] Figure 6 is an example diagram of a resource allocation method provided in an embodiment of the present application;

[0066] Figure 7 is a structural diagram of a resource allocation device provided in an embodiment of the present application;

[0067] Figure 8 It is a structural block diagram of a resource allocation device provided in an embodiment of the present application. DETAILED DESCRIPTION

[0068] In order to enable those skilled in the art to better understand the present application, the present application is further described in detail below in conjunction with the accompanying drawings and specific implementation methods. Obviously, the described embodiments are only part of the embodiments of the present application, rather than all of the embodiments. Based on the embodiments in the present application, all other embodiments obtained by ordinary technicians in the field without making creative work are within the scope of protection of the present application.

[0069] To facilitate understanding, some relevant concepts and application scenarios involved in the embodiments of the present application are first introduced below.

[0070] 1. Related concepts

[0071] Network resources refer to the sum of various information resources that can be used with the help of the network environment. These resources usually exist in the form of electronic resource data, including text, images, sounds, animations and other forms of information, stored in non-printed media such as optical and magnetic media.

[0072] Collections.shuffle is a Java Collections class method that works by randomly permuting the elements of a specified list. There are two different types of Java shuffle() methods, which can be distinguished based on their parameters, namely Java Collections shuffle(list) method and Java Collections shuffle(list,random) method.

[0073] Java Collections shuffle(list) method is used to work by randomly reordering the specified list elements using default randomness.

[0074] Java Collections shuffle(list, random) method is used to work by randomly reordering the list elements using the specified randomness.

[0075] getRandomHanzi is a function used to generate random Chinese characters. It can be used in various scenarios that require random generation of Chinese characters, such as generating verification codes, test data, random collection of characters, etc. This function can be implemented in a variety of ways depending on the scenario.

[0076] 2. Application Scenarios

[0077] With the rapid development of computer network technology, computers are becoming more and more popular, and network resources are becoming increasingly abundant, making the application of computers penetrate into all areas of society. At the same time, with the continuous development of mobile Internet technology, the number of users of electronic devices such as smart phones and tablets is also increasing. When the number of users is unknown, how to allocate network resources to users has become a technical problem that technicians in this field need to solve urgently.

[0078] For example, in many activity scenarios, it is necessary to randomly generate specific Chinese characters from a Chinese character set to complete activity tasks. However, when planning similar activities, it is difficult to control the number of users and ensure the number of attempts and successes.

[0079] Take a specific scenario as an example, in which the network resources refer to Chinese characters. For example, in some important promotional activities, in order to attract the attention of the masses, the organizer will attract traffic through on-site prize-winning and other methods. At present, with the prevalence of electronic devices such as smart phones and tablets and the popularity of mini programs, more promotional activities are combined with on-site and mini programs. For example, a new museum promotion activity is designed with a museum promotion activity mini program. Users enter the mini program and scan the on-site QR code (each scan will receive a Chinese character, and there is no limit to the number of scans for each user) to randomly receive Chinese characters. If the user collects a specific sequence of Chinese characters, such as the six Chinese characters of "Museum Night", he can receive souvenirs and other gifts from the museum on site with the instructions on the mini program. However, in this kind of activity, the number of gifts is usually limited, while the number of users and the number of times the users scan the code are unpredictable. It can be seen that how to control the number of times users collect a specific sequence of Chinese characters in such activity planning is a problem worth studying.

[0080] In the related art, when encountering this problem, the first thing considered is to achieve it through the probability P1 of collecting a specific Chinese character sequence. However, in the character collection activity, it is impossible to estimate the total number of users of this promotional activity, so there is no way to set the probability P1, where P1 = number of successes / total number of attempts, and total number of attempts = number of successes / P1.

[0081] This means that if you want to generate a certain Chinese character sequence with a probability of P1, you should theoretically try about the number of successes / P1. However, due to randomness, it may take more attempts to reach this probability. Therefore, in the code, the maximum number of attempts (MAX_TRIES) should be set larger than the actual value in order to reach the probability of P1 in actual operation.

[0082] But please note that this method is not mathematically strict and accurate, because it depends on the number of attempts and randomness. Due to the nature of randomness, it is difficult to directly control the probability of generating a specific sequence to P1, because this involves complex probability calculations. In actual situations, it may be necessary to calibrate the value of MAX_TRIES by running the program multiple times and statistically analyzing the results in order to more accurately control the probability of generating a specific Chinese character sequence.

[0083] Assume that in the event, the organizer wants to have 100 gifts on site, but does not know how many users will participate in the character collection activity, and this problem cannot be solved by setting the probability of collecting a specific Chinese character sequence as above. In order to solve the above technical problems, the embodiments of the present application provide a resource allocation method, apparatus, resource allocation device and storage medium.

[0084] Next, a resource allocation method provided in an embodiment of the present application is introduced in detail with reference to the accompanying drawings.

[0085] Figure 1 is a flow chart of a resource allocation method provided in an embodiment of the present application, which is applied to a resource allocation device. The resource allocation device can allocate N types of network resources, where N is an integer greater than 1, such as Figure 1 As shown, the method may include the following steps: step 101, step 102, step 103, step 104 and step 105;

[0086] In step 101, a first resource allocation request sent by a first user in a target scenario is received, wherein the first resource allocation request is used to request allocation of a network resource.

[0087] In the embodiment of the present application, the network resources may include any one of the following: image, text, video, audio, and the application scenarios are relatively wide.

[0088] In the embodiments of the present application, the target scenario refers to any scenario involving network resource allocation. In actual applications, the target scenario can be an online scenario or an offline scenario, for example, a scenario of scanning a code offline to collect a specific sequence of Chinese characters.

[0089] In some embodiments, the network resources include text, and the N types of network resources include: N different specific texts, the target scenario is a scenario of collecting N different specific texts to exchange for gifts, and the first quantity threshold is the quantity value of the gifts in the target scenario.

[0090] In the embodiment of the present application, considering that there are usually many users in the target scene, some users will participate in the resource allocation activity, while other users will not participate in the resource allocation activity. For example, in the offline promotion activity scene, some users participate in the activity of scanning the code to collect Chinese characters, while other users are just browsing and do not participate in the activity of collecting Chinese characters. Therefore, for the convenience of distinction, the user who participates in the resource allocation activity in the target scene is called the first user.

[0091] In the embodiment of the present application, the resource allocation request may be sent by a user through an electronic device used by the user, after the user scans a barcode in a target scene and triggers the electronic device to send the request to the resource allocation device.

[0092] For example, the barcode may be a QR code, such as Figure 2 As shown, many users (it could be 500, 1,000, or any other number) participated in the "Scan the QR code to collect the "Night at the Museum" event offline", and the event organizer provided 100 gifts.

[0093] From the user's perspective, every time user 1 scans a QR code using mobile phone 1, one Chinese character is obtained. After scanning the code multiple times, multiple Chinese characters are obtained. Similarly, every time user 2 scans a QR code using mobile phone 2, one Chinese character is obtained. After scanning the code multiple times, multiple Chinese characters are obtained. Multiple users can scan a QR code simultaneously.

[0094] Taking user 1 as an example, every time user 1 scans a QR code using mobile phone 1, it triggers mobile phone 1 to send a resource allocation request to the resource allocation device in the cloud. The resource allocation device responds to the resource allocation request and returns a Chinese character to mobile phone 1. For example, if user 1 scans the QR code 3 times in sequence using mobile phone 1, mobile phone 1 sends 3 resource allocation requests to the resource allocation device in sequence. The resource allocation device responds to the 3 resource allocation requests successively and returns 3 Chinese characters, such as "博 (bó)", "博 (bó)", and "夜 (yè)". Similarly, user 2 scans the QR code 4 times using mobile phone 2 and obtains 4 Chinese characters, such as "博 (bó)", "管 (guǎn)", "夜 (yè)", and "物 (wù)". The user's expectation is that through multiple QR code scans, the multiple Chinese characters obtained can form "博物馆奇妙夜 (The Muppet Movie)", and at this time, the user can obtain a gift.

[0095] In step 102, in response to the first resource allocation request, according to the first probability, a network resource is allocated to the first user, and the type information of the network resource allocated to the first user is recorded in the user database.

[0096] In the embodiments of the present application, the user database includes: the quantity of various network resources already allocated to each first user and the types to which each network resource belongs. The first probability is the probability set by humans for the first user to集齐 N types of network resources.

[0097] In the embodiments of the present application, after receiving the first resource allocation request, the resource allocation device can, according to the first probability, randomly generate a network resource and return this network resource to the first user, thereby realizing the allocation of a network resource to the first user. Or, if a resource pool is set in the resource allocation device and multiple network resources are pre-stored in the resource pool, after receiving the first resource allocation request, the resource allocation device can, according to the first probability, randomly select a network resource from the resource pool and return this network resource to the first user, thereby realizing the allocation of a network resource to the first user.

[0098] In step 103, according to the user database, it is determined whether the number of first users who have集齐 N types of network resources reaches the first quantity threshold. If so, the allocation times of a specific type of network resource among the N types of network resources are set.

[0099] In the embodiment of the present application, since the user database records the number of various network resources allocated to each first user and the type of each network resource, the number of first users who have collected N types of network resources can be accurately determined based on the user database.

[0100] In the embodiment of the present application, the specific type of network resources may be one type of network resources or at least two types of network resources.

[0101] In the embodiment of the present application, the first quantity threshold usually refers to the upper limit of the number of users who have collected N types of network resources, which is manually preset. For example, the number of gifts provided by the organizer of the event "Scan the code to collect the event "Night at the Museum"".

[0102] In an embodiment of the present application, in a network resource allocation scenario, when resources are initially allocated to each first user in the target scenario, the allocation is performed according to a set probability. As network resources are continuously allocated, when the number of users who have collected N types of network resources reaches a set upper limit, the number of users who have collected N types of network resources is controlled by controlling the subsequent number of allocations of a specific network resource.

[0103] In step 104, a second resource allocation request sent by a first user in the target scenario is received, wherein the second resource allocation request is used to request allocation of a network resource.

[0104] In an embodiment of the present application, although the number of users who have collected N types of network resources has reached the set upper limit, since the number of users in the target scenario is usually large, other users who have not collected N types of network resources may not be aware of the above situation and will continue to participate in resource allocation activities. At this time, these users will continue to send resource allocation requests (i.e., second resource allocation requests) to the resource allocation device.

[0105] In step 105, in response to the second resource allocation request, a network resource is allocated to the first user according to the set allocation times.

[0106] In an embodiment of the present application, according to the set number of allocations, one network resource is allocated to a user who has not collected N types of network resources, so that the user cannot collect N types of network resources subsequently, thereby achieving the goal of controlling the number of users who have collected N types of network resources in the target scenario to not exceed the set upper limit.

[0107] In some embodiments, Figure 3 As shown, the above step 105 may include the following steps: step 301, step 302 and step 303;

[0108] In step 301, a network resource is randomly generated according to the set allocation times and the second probability; wherein the second probability is an artificially set probability that the first user collects N types of network resources.

[0109] In the embodiment of the present application, the numerical values ​​of the second probability and the first probability may be the same or different.

[0110] In step 302, based on the user database and the type information of randomly generated network resources, determine the third probability and the actual number of allocations of a specific type of network resources after the number of first users who have collected N types of network resources reaches a first quantity threshold; wherein the third probability is the actual probability that the first user has collected N types of network resources.

[0111] In step 303, a network resource is allocated to the first user according to the second probability, the third probability, the set allocation times and the actual allocation times.

[0112] Optionally, when the number of types of network resources of a specific type is 1, such as Figure 4 As shown, the above step 303 may include the following steps: step 3031, step 3032, step 3033 and step 3034;

[0113] In step 3031, determine whether the third probability is less than or equal to the second probability; if so, execute step 3032, otherwise execute step 3034.

[0114] In step 3032, determine whether the actual number of allocations is less than or equal to the set number of allocations; if so, execute step 3033; otherwise, execute step 3034.

[0115] In the embodiment of the present application, when the third probability is less than or equal to the second probability, it is determined whether the actual number of allocations is less than or equal to the set number of allocations.

[0116] In step 3033, the randomly selected network resources are allocated to the first user, and the type information of the network resources allocated to the first user is recorded in the user database.

[0117] In the embodiment of the present application, when the actual number of allocations is less than or equal to the set number of allocations, the randomly selected network resources are allocated to the first user, and the type information of the network resources allocated to the first user is recorded in the user database.

[0118] In step 3034, the process returns to the step of randomly selecting a network resource according to the set allocation times and the second probability.

[0119] In the embodiment of the present application, when the third probability is greater than the second probability, or the actual number of allocations is greater than the set number of allocations, the above step 301 is returned to be executed.

[0120] Optionally, when the number of types of network resources of a specific type is M, M is an integer greater than 1 and less than N, such as Figure 5 As shown, the above step 303 may include the following steps: step 3035, step 3036, step 3037 and step 3038;

[0121] In step 3035 , determine whether the third probability is less than or equal to the second probability; if so, execute step 3036 , otherwise execute step 3038 .

[0122] In step 3036, determine whether the actual allocation times corresponding to each of the M specific types of network resources are less than or equal to the set allocation times; if so, execute step 3037, otherwise execute step 3038.

[0123] In the embodiment of the present application, when the third probability is less than or equal to the second probability, it is determined whether the actual number of allocations corresponding to each of the M specific types of network resources is less than or equal to the set number of allocations.

[0124] In step 3037, the randomly selected network resources are allocated to the first user, and the type information of the network resources allocated to the first user is recorded in the user database.

[0125] In the embodiment of the present application, when all actual allocation times are less than or equal to the set allocation times, the randomly selected network resources are allocated to the first user, and the type information of the network resources allocated to the first user is recorded in the user database.

[0126] In step 3038, the process returns to the step of randomly selecting a network resource according to the set allocation times and the second probability.

[0127] In the embodiment of the present application, when the third probability is greater than the second probability, or at least one actual allocation number is greater than the set allocation number, the above step 301 is returned to be executed.

[0128] As can be seen from the above embodiments, in this embodiment, the resource allocation device receives a first resource allocation request sent by a first user in a target scenario, where the first resource allocation request is used to request the allocation of a network resource; in response to the first resource allocation request, according to a first probability, a network resource is allocated to the first user, and the type information of the network resource allocated to the first user is recorded in the user database, where the user database includes: the quantity of various network resources already allocated to each first user and the types to which each network resource belongs, and the first probability is the probability, set manually, that the first user collects N types of network resources; according to the user database, it is determined whether the number of first users who have collected N types of network resources reaches a first quantity threshold, and if so, the allocation times of a specific type of network resource among the N types of network resources are set; a second resource allocation request sent by the first user in the target scenario is received, where the second resource allocation request is used to request the allocation of a network resource; in response to the second resource allocation request, a network resource is allocated to the first user according to the set allocation times, thereby realizing the allocation of network resources to users when the number of users is unknown.

[0129] For ease of understanding, a specific example is given below to illustrate in detail the resource allocation method provided by the embodiments of the present application.

[0130] The network resources include characters, and the N types of network resources include: N different specific characters. The target scenario is a scenario where N different specific characters are collected to exchange for gifts, and the first quantity threshold is the quantity value of the gifts in the target scenario.

[0131] For example, the N types of network resources are specifically the six Chinese characters "Night at the Museum". For example, in an offline activity scenario, 1000 users participate in the activity of scanning QR codes to obtain Chinese characters, and the activity organizer provides 100 gifts.

[0132] The activity organizer sets the initial probability that the first user collects N types of network resources as P2 (i.e., the first probability). 1000 users continuously scan the QR codes in the activity scenario with their mobile phones, and the resource allocation device returns Chinese characters to the 1000 users according to the probability P1. As these users continuously scan the codes, the users continuously obtain Chinese characters from the resource allocation device, and more and more users collect the six Chinese characters "Night at the Museum". When the resource allocation device detects that the number of users who have collected the six Chinese characters "Night at the Museum" reaches the gift quantity of 100, the backend code will be enabled to interfere with the allocation times of one of the six Chinese characters "Night at the Museum", for example, control the allocation times of the character "qi" among the six Chinese characters "Night at the Museum" so that the successful times are 100. By this method, both the upper limit of the number of users collecting Chinese characters can be controlled and the user experience will not be affected.

[0133] As Figure 6 shown, a process of controlling the collection of a specific Chinese character sequence by controlling the distribution times of a certain Chinese character is shown, which may include the following steps: Step 601, Step 602, Step 603, Step 604, Step 605, Step 606, and Step 607;

[0134] In step 601, determine the target Chinese character sequence. For example, "Night at the Museum".

[0135] In step 602, set the initial probability P2 for the target Chinese character sequence to be collected.

[0136] In step 603, set the distribution times of a certain specific Chinese character to K; where K = 1,.... For example, the distribution times of the character "qi" is 2.

[0137] In step 604, randomly generate Chinese characters according to the probability P2 and K.

[0138] In step 605, calculate the actual probability P3 for the target Chinese character sequence to be collected according to the final actual generated Chinese character result.

[0139] In step 606, determine whether P3 is less than or equal to P2. If so, determine whether the actual distribution times of the specific Chinese character is greater than K. If so, recursively execute step 602; otherwise, execute step 607.

[0140] In step 607, return the randomly generated Chinese characters to the user and update the user database.

[0141] If the above process is written in Java code, the getRandomHanzi method will generate random Chinese character characters, not just the characters in "Night at the Museum". Therefore, if you want the randomly generated Chinese characters to be limited to several specific Chinese characters such as "Night at the Museum", you need to modify the getRandomHanzi method to make it select only from this limited character set.

[0142] First, ensure that the generated sequence always contains the six characters "Night at the Museum" (only the number of the character "qi" is fixed), and then add the other Chinese characters in "Night at the Museum" to the sequence first. By using a certain parameter in the function body to check whether the result containing too many "qi" characters should be avoided. The specific logic and probability settings of the function are as follows:

[0143] function randomFun(){

[0144] var yecount = context.getArg('yecount');

[0145] var str = 'Museum Night';

[0146] var result = "";

[0147] var totalProbability = 0.12;

[0148] for (var i = 0; i < str.length; i++) {

[0149] var randomNum = Math.random();

[0150] var charProbability = 1 / (str.length - i); / / Calculate the probability of each character

[0151] if (randomNum <= totalProbability) {

[0152] result += str.charAt(i);

[0153] totalProbability -= charProbability;

[0154] if (result == '奇' && yecount > 100) {

[0155] result = '博'; / / Here, re-running the randomFun() loop or making a recursive function call to generate a new random substring might be the best design choice.

[0156] }

[0157] context.setReturn('suijijieguo', result);

[0158] return;

[0159] }

[0160] }

[0161] if (result == "") {

[0162] randomFun();

[0163] }

[0164] }

[0165] randomFun();

[0166] This JavaScript code implements a function named randomFun. The goal of this function is to randomly generate a substring composed of characters from the given string "Night at the Museum". Input parameter: The function accepts a parameter named yecount, which is used within the function to check whether to avoid generating results that contain too many "qi" characters. Initialization: The str variable stores the original string "Night at the Museum" from which characters will be randomly selected. The result variable is used to store the final generated random substring. The totalProbability variable is set to 0.12, representing the initial random selection probability. Loop: The function traverses each character in str through a for loop. Random selection and probability: In each loop, a random number randomNum between 0 and 1 is generated; the probability charProbability of the current character being selected is calculated, which is 1 divided by the number of remaining unselected characters. Character selection: If randomNum is less than or equal to totalProbability, the current character is selected and added to result; after each character is selected, totalProbability is subtracted by charProbability, so that as the loop progresses, the probability of selecting the next character gradually decreases. Special condition: If the generated result is exactly "qi" and yecount is greater than 100, then result is reset to "bo". This can be regarded as a strategy to avoid generating too many identical characters. Return result: Once a character is selected, the function sets a return value through context.setReturn('suijijieguo', result) and ends the function execution through the return statement. This function attempts to implement a probability-based random substring generator.

[0167] It can be seen that in the embodiments of this application, by controlling the number of times of a certain parameter to control the overall number of successful times that need to be controlled in the business, and by using the Java Collections shuffle method to achieve randomness and randomly reorder the list elements to work, the randomness and upper limit number predetermined for the business are ensured, thus solving the problem of being unable to control the number of successful times in various promotional business scenarios, improving the user experience and ensuring the winning rate.

[0168] Corresponding to the above method embodiments, the embodiments of this application also provide a resource allocation device. The resource allocation device described below can be mutually referred to with the resource allocation method described above.

[0169] Figure 7is a schematic diagram of a structure of a resource allocation device provided in an embodiment of the present application, which is applied to a resource allocation device, wherein the resource allocation device can allocate N types of network resources, where N is an integer greater than 1, such as Figure 7 As shown, the resource allocation device 700 may include: a first receiving module 701, a first allocation module 702, a determination module 703, a setting module 704, a second receiving module 705 and a second allocation module 706;

[0170] A first receiving module 701 is configured to receive a first resource allocation request sent by a first user in a target scenario, wherein the first resource allocation request is used to request allocation of a network resource;

[0171] A first allocation module 702 is configured to allocate a network resource to the first user in response to the first resource allocation request according to a first probability, and record the type information of the network resource allocated to the first user in a user database, wherein the user database includes: the number of various network resources allocated to each of the first users and the type of each network resource, and the first probability is an artificially set probability that the first user collects all the N types of network resources;

[0172] A determination module 703 is used to determine whether the number of first users who have collected the N types of network resources reaches a first number threshold according to the user database;

[0173] A setting module 704 is used to set the number of allocations of a specific type of network resources among the N types of network resources when the number of first users who have collected the N types of network resources reaches a first number threshold;

[0174] A second receiving module 705 is configured to receive a second resource allocation request sent by a first user in the target scenario, wherein the second resource allocation request is used to request allocation of a network resource;

[0175] The second allocation module 706 is configured to allocate a network resource to the first user in response to the second resource allocation request and according to a set allocation number.

[0176] As can be seen from the above embodiments, in this embodiment, the resource allocation device receives a first resource allocation request sent by a first user in the target scenario, wherein the first resource allocation request is used to request allocation of a network resource; in response to the first resource allocation request, a network resource is allocated to the first user according to a first probability, and the type information of the network resource allocated to the first user is recorded in a user database, wherein the user database includes: the number of various network resources allocated to each first user and the type of each network resource, and the first probability is an artificially set probability that the first user has collected N types of network resources; according to the user database, it is determined whether the number of first users who have collected N types of network resources reaches a first quantity threshold, and if so, the number of allocations of a specific type of network resource among the N types of network resources is set; a second resource allocation request is received from the first user in the target scenario, wherein the second resource allocation request is used to request allocation of a network resource; in response to the second resource allocation request, a network resource is allocated to the first user according to the set number of allocations, thereby allocating network resources to users when the number of users is unknown.

[0177] Optionally, as an embodiment, the second allocation module 706 may include:

[0178] A generating submodule, configured to randomly generate a network resource according to a set number of allocations and a second probability, wherein the second probability is an artificially set probability that the first user collects all the N types of network resources;

[0179] a determination submodule, configured to determine, according to the user database and the type information of the randomly generated network resources, a third probability and a real allocation number of the specific type of network resources after the number of first users who have collected the N types of network resources reaches a first quantity threshold, wherein the third probability is a real probability that the first user has collected the N types of network resources;

[0180] An allocation submodule is used to allocate a network resource to the first user according to the second probability, the third probability, the set allocation number and the actual allocation number.

[0181] Optionally, as an embodiment, the number of types of the specific type of network resources is 1;

[0182] The allocation submodule may include:

[0183] A first determining unit, configured to determine whether the third probability is less than or equal to the second probability;

[0184] a second determining unit, configured to determine whether the actual number of allocations is less than or equal to a set number of allocations if the third probability is less than or equal to the second probability;

[0185] a first allocation unit, configured to allocate the randomly selected network resource to the first user if the actual allocation number is less than or equal to the set allocation number, and record type information of the network resource allocated to the first user in a user database;

[0186] The first loop unit is used to return to the step of randomly selecting a network resource according to the set allocation number and the second probability if the third probability is greater than the second probability, or the actual allocation number is greater than the set allocation number.

[0187] Optionally, as an embodiment, the number of types of the specific type of network resources is M, where M is an integer greater than 1 and less than N;

[0188] The allocation submodule may include:

[0189] a third determining unit, configured to determine whether the third probability is less than or equal to the second probability;

[0190] a fourth determining unit, configured to determine whether the actual allocation times corresponding to each of the M specific types of network resources are all less than or equal to the set allocation times if the third probability is less than or equal to the second probability;

[0191] a second allocation unit, configured to allocate the randomly selected network resource to the first user if all the actual allocation times are less than or equal to the set allocation times, and record the type information of the network resource allocated to the first user into a user database;

[0192] The second loop unit is used to return to the step of randomly selecting a network resource according to the set allocation number and the second probability if the third probability is greater than the second probability, or at least one of the actual allocation times is greater than the set allocation number.

[0193] Optionally, as an embodiment, the resource allocation request is sent by the user through an electronic device used by the user, after the user scans a barcode in the target scene and triggers the electronic device to send the request to the resource allocation device.

[0194] Optionally, as an embodiment, the network resource may include any one of the following: image, text, video, audio.

[0195] Optionally, as an embodiment, the network resources include text; the N types of network resources include: N different specific texts; the target scenario is a scenario in which the N different specific texts are collected to exchange for gifts, and the first quantity threshold is the quantity value of gifts under the target scenario.

[0196] Regarding the device in the above embodiment, the specific manner in which each module performs operations has been described in detail in the embodiment of the method, and will not be elaborated here.

[0197] Corresponding to the above method embodiment, an embodiment of the present application further provides a resource allocation device, including: a memory for storing a computer program; a processor for implementing the steps of the above resource allocation method when executing the computer program.

[0198] like Figure 8 8 is a schematic diagram of the composition structure of a resource allocation device, which may include: a processor 810, a memory 820, a communication interface 830 and a communication bus 840. The processor 810, the memory 820 and the communication interface 830 communicate with each other through the communication bus 840.

[0199] In the embodiment of the present application, the processor 810 may be a central processing unit (CPU), an application specific integrated circuit, a digital signal processor, a field programmable gate array, or other programmable logic devices.

[0200] The processor 810 may call the program stored in the memory 820. Specifically, the processor 810 may perform the operations in the embodiment of the system management method. The memory 820 is used to store one or more programs. The program may include program code, and the program code includes computer operation instructions. In the embodiment of the present application, the memory 820 at least stores a program for implementing the following functions:

[0201] A first resource allocation request is received from a first user in a target scenario, wherein the first resource allocation request is used to request allocation of a network resource; in response to the first resource allocation request, a network resource is allocated to the first user according to a first probability, and the type information of the network resource allocated to the first user is recorded in a user database, wherein the user database includes: the number of various network resources allocated to each of the first users and the type of each network resource, and the first probability is an artificially set probability that the first user has collected the N types of network resources; according to the user database, it is determined whether the number of first users who have collected the N types of network resources reaches a first quantity threshold, and if so, the number of allocations of a specific type of network resource among the N types of network resources is set; a second resource allocation request is received from the first user in the target scenario, wherein the second resource allocation request is used to request allocation of a network resource; in response to the second resource allocation request, a network resource is allocated to the first user according to the set number of allocations.

[0202] In one possible implementation, the memory 820 may include a program storage area and a data storage area, wherein the program storage area may store an operating system and an application required for at least one function, etc.; the data storage area may store data created during use.

[0203] In addition, the memory 820 may include a high-speed random access memory, and may also include a non-volatile memory, such as at least one disk storage device or other volatile solid-state storage device. The communication interface 830 may be an interface of a communication module, which is used to connect to other devices or systems. Of course, it should be noted that Figure 8 The structure shown does not constitute a limitation on the resource allocation device in the embodiment of the present application. In actual applications, the resource allocation device may include Figure 8 More or fewer components than shown, or combinations of certain components.

[0204] Corresponding to the above method embodiment, the embodiment of the present application further provides a computer-readable storage medium, on which a computer program is stored, and when the computer program is executed by a processor, the steps of the above resource allocation method are implemented.

[0205] In addition, it should be noted that the embodiment of the present application also provides a computer program product or a computer program, which may include a computer instruction, which may be stored in a computer-readable storage medium. The processor of the computer device reads the computer instruction from the computer-readable storage medium, and the processor may execute the computer instruction so that the computer device executes the description of the resource allocation method in the corresponding embodiment above, so it will not be repeated here. In addition, the description of the beneficial effects of the same method will not be repeated. For technical details not disclosed in the computer program product or computer program embodiment involved in this application, please refer to the description of the method embodiment of this application.

[0206] In this specification, each embodiment is described in a progressive manner, and each embodiment focuses on the differences from other embodiments, and the same or similar parts between the embodiments can be referred to each other. Professionals can also further realize that the units and algorithm steps of each example described in conjunction with the embodiments disclosed herein can be implemented with electronic hardware, computer software or a combination of the two. In order to clearly illustrate the interchangeability of hardware and software, the composition and steps of each example have been generally described in the above description according to the function. Whether these functions are executed in hardware or software depends on the specific application and design constraints of the technical solution. Professional and technical personnel can use different methods to implement the described functions for each specific application, but such implementation should not be considered to exceed the scope of this application.

[0207] The steps of the method or algorithm described in conjunction with the embodiments disclosed herein may be implemented directly using hardware, a software module executed by a processor, or a combination of the two. The software module may be placed in a random access memory (RAM), a memory, a read-only memory (ROM), an electrically programmable ROM, an electrically erasable programmable ROM, a register, a hard disk, a removable disk, a CD-ROM, or any other form of storage medium known in the art.

[0208] Specific examples are used herein to illustrate the principles and implementation methods of the present application, and the description of the above embodiments is only used to help understand the technical solution and core ideas of the present application. It should be pointed out that for ordinary technicians in this technical field, without departing from the principles of the present application, several improvements and modifications can be made to the present application, and these improvements and modifications also fall within the scope of protection of the claims of the present application.

Claims

1. A resource allocation method, characterized in that: Applied to a resource allocation device, the resource allocation device can allocate N types of network resources, where N is an integer greater than 1, and the method includes: Receiving a first resource allocation request sent by a first user in a target scenario, wherein the first resource allocation request is used to request allocation of a network resource; In response to the first resource allocation request, a network resource is allocated to the first user according to a first probability, and type information of the network resource allocated to the first user is recorded in a user database, wherein the user database includes: the number of various network resources allocated to each of the first users and the type of each network resource, and the first probability is an artificially set probability that the first user collects all the N types of network resources; Determine, according to the user database, whether the number of first users who have collected the N types of network resources reaches a first quantity threshold, and if so, set the number of allocations of a specific type of network resource among the N types of network resources; receiving a second resource allocation request sent by a first user in the target scenario, wherein the second resource allocation request is used to request allocation of a network resource; In response to the second resource allocation request, a network resource is allocated to the first user according to the set allocation number.

2. The method according to claim 1, characterized in that The allocating a network resource to the first user according to the set allocation number includes: Randomly generate a network resource according to the set allocation times and the second probability, wherein the second probability is an artificially set probability that the first user collects all the N types of network resources; Determine, according to the user database and the type information of the randomly generated network resources, a third probability and a real allocation number of the specific type of network resources after the number of first users who have collected the N types of network resources reaches a first quantity threshold, wherein the third probability is a real probability that the first user collects the N types of network resources; A network resource is allocated to the first user according to the second probability, the third probability, the set allocation times and the actual allocation times.

3. The method according to claim 2, characterized in that The number of types of the specific type of network resources is 1; The allocating a network resource to the first user according to the second probability, the third probability, the set allocation times and the actual allocation times includes: determining whether the third probability is less than or equal to the second probability; If the third probability is less than or equal to the second probability, determining whether the actual number of allocations is less than or equal to the set number of allocations; If the actual number of allocations is less than or equal to the set number of allocations, the randomly selected network resource is allocated to the first user, and the type information of the network resource allocated to the first user is recorded in the user database; If the third probability is greater than the second probability, or the actual number of allocations is greater than the set number of allocations, the method returns to the step of randomly selecting a network resource according to the set number of allocations and the second probability.

4. The method according to claim 2, characterized in that: The number of types of the specific type of network resources is M, where M is an integer greater than 1 and less than N; The allocating a network resource to the first user according to the second probability, the third probability, the set allocation times and the actual allocation times includes: determining whether the third probability is less than or equal to the second probability; If the third probability is less than or equal to the second probability, determining whether the actual allocation times corresponding to each of the M specific types of network resources are all less than or equal to the set allocation times; If all the actual allocation times are less than or equal to the set allocation times, allocating the randomly selected network resource to the first user, and recording the type information of the network resource allocated to the first user in the user database; If the third probability is greater than the second probability, or at least one of the actual allocation times is greater than the set allocation times, the process returns to the step of randomly selecting a network resource according to the set allocation times and the second probability.

5. The method according to any one of claims 1 to 4, characterized in that: The resource allocation request is sent by the electronic device to the resource allocation device after the user scans the barcode in the target scene through the electronic device used by the user.

6. The method according to claim 5, characterized in that The network resources include any one of the following: images, texts, videos, and audios.

7. The method according to claim 6, characterized in that The network resources include text; the N types of network resources include: N different specific texts; the target scenario is a scenario in which the N different specific texts are collected to exchange for gifts, and the first quantity threshold is the quantity value of gifts in the target scenario.

8. A resource allocation device, characterized in that: Applied to a resource allocation device, the resource allocation device can allocate N types of network resources, N is an integer greater than 1, and the device includes: A first receiving module, configured to receive a first resource allocation request sent by a first user in a target scenario, wherein the first resource allocation request is used to request allocation of a network resource; a first allocation module, configured to respond to the first resource allocation request, allocate a network resource to the first user according to a first probability, and record type information of the network resource allocated to the first user into a user database, wherein the user database includes: the number of various network resources allocated to each of the first users and the type of each network resource, and the first probability is an artificially set probability that the first user collects all of the N types of network resources; A determination module, configured to determine, according to the user database, whether the number of first users who have collected the N types of network resources reaches a first number threshold; A setting module, configured to set the number of allocations of a specific type of network resource among the N types of network resources when the number of first users who have collected the N types of network resources reaches a first number threshold; A second receiving module, configured to receive a second resource allocation request sent by a first user in the target scenario, wherein the second resource allocation request is used to request allocation of a network resource; The second allocation module is used to allocate a network resource to the first user according to a set allocation number in response to the second resource allocation request.

9. A resource allocation device, comprising a memory, a processor and a computer program stored in the memory, characterized in that: The processor executes the computer program to implement the resource allocation method according to any one of claims 1 to 7.

10. A computer-readable storage medium having a computer program / instruction stored thereon, characterized in that: When the computer program / instruction is executed by a processor, the resource allocation method according to any one of claims 1 to 7 is implemented.

Citation Information

Patent Citations

  • Interaction method based on vehicle machine terminal screensaver

    CN111614836A

  • Live broadcast interaction method and device, electronic equipment and storage medium

    CN112188297A

  • Resource allocation method and device, storage medium and computer equipment

    CN116227827A

  • Virtual resource allocation method and apparatus, and storage device

    CN116521323A

  • Virtual gift merging method and device, electronic equipment and computer readable medium

    CN116800834A