CN118972438A - Resource allocation method, device, resource allocation equipment and storage medium - Google Patents
Resource allocation method, device, resource allocation equipment and storage medium Download PDFInfo
- Publication number
- CN118972438A CN118972438A CN202410962550.5A CN202410962550A CN118972438A CN 118972438 A CN118972438 A CN 118972438A CN 202410962550 A CN202410962550 A CN 202410962550A CN 118972438 A CN118972438 A CN 118972438A
- Authority
- CN
- China
- Prior art keywords
- probability
- user
- resource
- allocation
- network
- 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
-
- H—ELECTRICITY
- H04—ELECTRIC COMMUNICATION TECHNIQUE
- H04L—TRANSMISSION OF DIGITAL INFORMATION, e.g. TELEGRAPHIC COMMUNICATION
- H04L67/00—Network arrangements or protocols for supporting network services or applications
- H04L67/50—Network services
-
- G—PHYSICS
- G06—COMPUTING OR CALCULATING; 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
- G06Q30/00—Commerce
- G06Q30/02—Marketing; Price estimation or determination; Fundraising
- G06Q30/0207—Discounts or incentives, e.g. coupons or rebates
-
- H—ELECTRICITY
- H04—ELECTRIC COMMUNICATION TECHNIQUE
- H04L—TRANSMISSION OF DIGITAL INFORMATION, e.g. TELEGRAPHIC COMMUNICATION
- H04L67/00—Network arrangements or protocols for supporting network services or applications
- H04L67/50—Network services
- H04L67/51—Discovery or management thereof, e.g. service location protocol [SLP] or web services
Landscapes
- Engineering & Computer Science (AREA)
- Business, Economics & Management (AREA)
- Computer Networks & Wireless Communication (AREA)
- Signal Processing (AREA)
- Accounting & Taxation (AREA)
- Development Economics (AREA)
- Strategic Management (AREA)
- Finance (AREA)
- Game Theory and Decision Science (AREA)
- Entrepreneurship & Innovation (AREA)
- Economics (AREA)
- Marketing (AREA)
- Physics & Mathematics (AREA)
- General Business, Economics & Management (AREA)
- General Physics & Mathematics (AREA)
- Theoretical Computer Science (AREA)
- Telephonic Communication Services (AREA)
Abstract
Description
技术领域Technical Field
本申请涉及计算机网络技术领域,特别涉及一种资源分配方法、装置、资源分配设备及存储介质。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
随着计算机网络技术的快速发展,计算机不断普及,网络资源日益丰富,使得计算机的应用渗透到社会的各个领域,其中,网络资源主要是指借助于网络环境可以利用的各种信息资源的总和,这些资源通常以电子资源数据的形式存在,包括文字、图像、声音、动画等多种形式的信息,存储在光、磁等非印刷的介质中。与此同时,随着移动互联网技术的不断发展,智能手机、平板电脑等电子设备的用户也越来越多,在用户数量未知的情况下,如何为用户分配网络资源成为本领域技术人员亟待解决的技术问题。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
本申请实施例提供一种资源分配方法、装置、资源分配设备及存储介质,能够实现在用户数量未知的情况下,为用户分配网络资源。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.
根据本申请的第一方面,公开了一种资源分配方法,应用于资源分配设备,所述资源分配设备可分配N种类型的网络资源,N为大于1的整数,所述方法包括: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:
接收目标场景内的第一用户发送的第一资源分配请求,其中,所述第一资源分配请求用于请求分配一个网络资源;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;
响应于所述第一资源分配请求,根据第一概率,为所述第一用户分配一个网络资源,并将分配给所述第一用户的网络资源的类型信息记录到用户数据库中,其中,所述用户数据库中包括:各个所述第一用户已分配的各种网络资源的数量和各个网络资源所属的类型,所述第一概率是人为设定的所述第一用户集齐所述N种类型的网络资源的概率;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;
根据所述用户数据库,确定已集齐所述N种类型的网络资源的第一用户的数量是否达到第一数量阈值,若是,则设置所述N种类型的网络资源中特定类型的网络资源的分配次数;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.
可选地,作为一个实施例,所述根据所设置的分配次数,为所述第一用户分配一个网络资源,包括:Optionally, as an embodiment, allocating a network resource to the first user according to the set allocation number includes:
根据所设定的分配次数和第二概率,随机生成一个网络资源,其中,所述第二概率是人为设定的所述第一用户集齐所述N种类型的网络资源的概率;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;
根据所述用户数据库和随机生成的网络资源的类型信息,确定第三概率和所述特定类型的网络资源在已集齐所述N种类型的网络资源的第一用户的数量达到第一数量阈值之后的真实分配次数,其中,所述第三概率是所述第一用户集齐所述N种类型的网络资源的真实概率;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.
可选地,作为一个实施例,所述特定类型的网络资源的类型数量是1;Optionally, as an embodiment, 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.
可选地,作为一个实施例,所述特定类型的网络资源的类型数量是M,M是大于1且小于N的整数;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;
所述根据所述第二概率、所述第三概率、所设置的分配次数和所述真实分配次数,为所述第一用户分配一个网络资源,包括: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;
若所述第三概率小于或者等于所述第二概率,则确定所述M个特定类型的网络资源各自对应的所述真实分配次数是否均小于或者等于所设置的分配次数;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.
可选地,作为一个实施例,所述资源分配请求是用户通过自身所使用的电子设备,扫描所述目标场景内的条形码后触发所述电子设备向所述资源分配设备发送的。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.
可选地,作为一个实施例,所述网络资源包括以下任意一项:图像、文字、视频、音频。Optionally, as an embodiment, the network resource includes any one of the following: image, text, video, audio.
可选地,作为一个实施例,所述网络资源包括文字;所述N种类型的网络资源包括:N个不同的特定文字;所述目标场景是集齐所述N个不同的特定文字兑换礼品的场景,所述第一数量阈值是所述目标场景下礼品的数量值。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.
根据本申请的第二方面,公开了一种资源分配装置,应用于资源分配设备,所述资源分配设备可分配N种类型的网络资源,N为大于1的整数,所述装置包括: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:
第一接收模块,用于接收目标场景内的第一用户发送的第一资源分配请求,其中,所述第一资源分配请求用于请求分配一个网络资源;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;
第一分配模块,用于响应于所述第一资源分配请求,根据第一概率,为所述第一用户分配一个网络资源,并将分配给所述第一用户的网络资源的类型信息记录到用户数据库中,其中,所述用户数据库中包括:各个所述第一用户已分配的各种网络资源的数量和各个网络资源所属的类型,所述第一概率是人为设定的所述第一用户集齐所述N种类型的网络资源的概率;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;
确定模块,用于根据所述用户数据库,确定已集齐所述N种类型的网络资源的第一用户的数量是否达到第一数量阈值;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;
设置模块,用于在已集齐所述N种类型的网络资源的第一用户的数量达到第一数量阈值的情况下,设置所述N种类型的网络资源中特定类型的网络资源的分配次数;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.
可选地,作为一个实施例,所述第二分配模块包括:Optionally, as an embodiment, the second allocation module includes:
生成子模块,用于根据所设定的分配次数和第二概率,随机生成一个网络资源,其中,所述第二概率是人为设定的所述第一用户集齐所述N种类型的网络资源的概率;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;
确定子模块,用于根据所述用户数据库和随机生成的网络资源的类型信息,确定第三概率和所述特定类型的网络资源在已集齐所述N种类型的网络资源的第一用户的数量达到第一数量阈值之后的真实分配次数,其中,所述第三概率是所述第一用户集齐所述N种类型的网络资源的真实概率;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;
分配子模块,用于根据所述第二概率、所述第三概率、所设置的分配次数和所述真实分配次数,为所述第一用户分配一个网络资源。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.
可选地,作为一个实施例,所述特定类型的网络资源的类型数量是1;Optionally, as an embodiment, the number of types of the specific type of network resources is 1;
所述分配子模块包括:The allocation submodule comprises:
第一确定单元,用于确定所述第三概率是否小于或者等于所述第二概率;A first determining unit, configured to determine whether the third probability is less than or equal to the second probability;
第二确定单元,用于若所述第三概率小于或者等于所述第二概率,则确定所述真实分配次数是否小于或者等于所设置的分配次数;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;
第一分配单元,用于若所述真实分配次数小于或者等于所设置的分配次数,则将所述随机选择的网络资源分配给所述第一用户,并将分配给所述第一用户的网络资源的类型信息记录到用户数据库中;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;
第一循环单元,用于若所述第三概率大于所述第二概率,或者所述真实分配次数大于所设置的分配次数,则返回执行根据所设定的分配次数和所述第二概率,随机选择一个网络资源的步骤。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.
可选地,作为一个实施例,所述特定类型的网络资源的类型数量是M,M是大于1且小于N的整数;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;
所述分配子模块包括:The allocation submodule comprises:
第三确定单元,用于确定所述第三概率是否小于或者等于所述第二概率;a third determining unit, configured to determine whether the third probability is less than or equal to the second probability;
第四确定单元,用于若所述第三概率小于或者等于所述第二概率,则确定所述M个特定类型的网络资源各自对应的所述真实分配次数是否均小于或者等于所设置的分配次数;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;
第二分配单元,用于若所有所述真实分配次数均小于或者等于所设置的分配次数,则将所述随机选择的网络资源分配给所述第一用户,并将分配给所述第一用户的网络资源的类型信息记录到用户数据库中;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;
第二循环单元,用于若所述第三概率大于所述第二概率,或者至少一个所述真实分配次数大于所设置的分配次数,则返回执行根据所设定的分配次数和所述第二概率,随机选择一个网络资源的步骤。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.
可选地,作为一个实施例,所述资源分配请求是用户通过自身所使用的电子设备,扫描所述目标场景内的条形码后触发所述电子设备向所述资源分配设备发送的。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.
可选地,作为一个实施例,所述网络资源包括以下任意一项:图像、文字、视频、音频。Optionally, as an embodiment, the network resource includes any one of the following: image, text, video, audio.
可选地,作为一个实施例,所述网络资源包括文字;所述N种类型的网络资源包括:N个不同的特定文字;所述目标场景是集齐所述N个不同的特定文字兑换礼品的场景,所述第一数量阈值是所述目标场景下礼品的数量值。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.
根据本申请的第三方面,公开了一种资源分配设备,包括存储器、处理器及存储在存储器上的计算机程序,所述处理器执行所述计算机程序以实现如第一方面中的资源分配方法。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.
根据本申请的第四方面,公开了一种计算机可读存储介质,其上存储有计算机程序/指令,该计算机程序/指令被处理器执行时实现如第一方面中的资源分配方法。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.
根据本申请的第五方面,公开了一种计算机程序产品,包括计算机程序/指令,该计算机程序/指令被处理器执行时实现如第一方面中的资源分配方法。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.
本申请实施例中,资源分配设备接收目标场景内的第一用户发送的第一资源分配请求,其中,第一资源分配请求用于请求分配一个网络资源;响应于第一资源分配请求,根据第一概率,为第一用户分配一个网络资源,并将分配给第一用户的网络资源的类型信息记录到用户数据库中,其中,用户数据库中包括:各个第一用户已分配的各种网络资源的数量和各个网络资源所属的类型,第一概率是人为设定的第一用户集齐N种类型的网络资源的概率;根据用户数据库,确定已集齐N种类型的网络资源的第一用户的数量是否达到第一数量阈值,若是,则设置N种类型的网络资源中特定类型的网络资源的分配次数;接收目标场景内的第一用户发送的第二资源分配请求,其中,第二资源分配请求用于请求分配一个网络资源;响应于第二资源分配请求,根据所设置的分配次数,为第一用户分配一个网络资源,从而实现在用户数量未知的情况下,为用户分配网络资源。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
为了更清楚地说明本申请实施例或现有技术中的技术方案,下面将对实施例或现有技术描述中所需要使用的附图作简单地介绍,显而易见地,下面描述中的附图仅仅是本申请的一些实施例,对于本领域普通技术人员来讲,在不付出创造性劳动的前提下,还可以根据这些附图获得其他的附图。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.
图1是本申请实施例提供的一种资源分配方法的流程图;FIG1 is a flow chart of a resource allocation method provided in an embodiment of the present application;
图2是本申请实施例提供的一种资源分配方法的应用场景图;FIG2 is an application scenario diagram of a resource allocation method provided in an embodiment of the present application;
图3是本申请实施例提供的一种步骤105的一种实施方式的流程图;FIG3 is a flow chart of an implementation of step 105 provided in an embodiment of the present application;
图4是本申请实施例提供的一种步骤303的一种实施方式的流程图之一;FIG. 4 is a flowchart of one implementation of step 303 provided in an embodiment of the present application;
图5是本申请实施例提供的一种步骤303的一种实施方式的流程图之二;FIG5 is a second flowchart of an implementation of step 303 provided in an embodiment of the present application;
图6是本申请实施例提供的一种资源分配方法的示例图;FIG6 is an example diagram of a resource allocation method provided in an embodiment of the present application;
图7是本申请实施例提供的一种资源分配装置的结构示意图;FIG7 is a schematic diagram of the structure of a resource allocation device provided in an embodiment of the present application;
图8是本申请实施例提供的一种资源分配设备的结构框图。FIG8 is a structural block diagram of a resource allocation device provided in an embodiment of the present application.
具体实施方式DETAILED DESCRIPTION
为了使本技术领域的人员更好地理解本申请方案,下面结合附图和具体实施方式对本申请作进一步的详细说明。显然,所描述的实施例仅仅是本申请一部分实施例,而不是全部的实施例。基于本申请中的实施例,本领域普通技术人员在没有做出创造性劳动前提下所获得的所有其他实施例,都属于本申请保护的范围。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.
为了便于理解,下面首先对本申请实施例中涉及到的一些相关概念和应用场景进行介绍。To facilitate understanding, some relevant concepts and application scenarios involved in the embodiments of the present application are first introduced below.
一、相关概念1. Related concepts
网络资源,是指借助于网络环境可以利用的各种信息资源的总和,这些资源通常以电子资源数据的形式存在,包括文字、图像、声音、动画等多种形式的信息,存储在光、磁等非印刷的介质中。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.
Collections.shuffle,是一个Java Collections类方法,其工作原理是随机置换指定列表元素,其中,有两种不同类型的Java shuffle()方法,可以根据其参数进行区分,分别是Java Collections shuffle(list)方法和Java Collections shuffle(list,random)方法。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.
Java Collections shuffle(list)方法,用于通过使用默认随机性对指定的列表元素进行随机重新排序来工作。Java Collections shuffle(list) method is used to work by randomly reordering the specified list elements using default randomness.
Java Collections shuffle(list,random)方法,用于通过使用指定的随机性对列表元素进行随机重新排序来工作。Java Collections shuffle(list, random) method is used to work by randomly reordering the list elements using the specified randomness.
getRandomHanzi,是一个函数,用于生成随机的汉字,它可以用于各种需要随机生成汉字的场景,例如生成验证码、测试数据、随机集字等,这个函数的实现方式可以根据场景有多种。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.
二、应用场景2. Application Scenarios
随着计算机网络技术的快速发展,计算机不断普及,网络资源日益丰富,使得计算机的应用渗透到社会的各个领域。与此同时,随着移动互联网技术的不断发展,智能手机、平板电脑等电子设备的用户也越来越多,在用户数量未知的情况下,如何为用户分配网络资源成为本领域技术人员亟待解决的技术问题。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.
例如,在许多活动场景中,需要从汉字集中随机生成特定的汉字来完成活动任务,但是策划类似的活动中会遇到用户量难以控制,无法确保尝试次数和成功次数的难题。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 it is impossible to ensure the number of attempts and successes.
以一个具体场景为例,该场景中网络资源指的是汉字。例如,在某些重要的宣传活动中,主办方为了吸引群众的眼球,会通过现场中奖等方式吸引流量。目前,随着智能手机、平板电脑等电子设备的普遍以及小程序的流行,更多宣传活动结合现场和小程序来进行,例如,某个新开的博物馆宣传活动,设计一个博物馆宣传活动小程序,用户通过进入小程序后扫描现场二维码(每扫描一次,领取一个汉字,每个用户的扫描次数不设限),随机领取汉字,如果用户集齐了特定的汉字序列,比如“博物馆奇妙夜”这六个汉字,则可以凭借小程序上的指示在现场领取博物馆的纪念品等礼品,但是这种活动,礼品数量通常是有限的,而用户的数量和用户的扫码次数却是不可预估的,可见,此类活动策划中应如何控制用户集齐特定的汉字序列次数是一个值得研究的问题。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.
相关技术中,遇到这种问题,首先考虑的是通过集齐特定的汉字序列的概率P1实现,然而在集字活动中,无法预估这种宣传活动的总的用户量,因此没有办法设定概率P1,其中,P1=成功次数/总尝试次数,总尝试次数=成功次数/P1。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.
这意味着,如果想要生成特定的汉字序列的概率为P1,理论上应该尝试大约成功次数/P1。然而,由于随机性,实际上可能需要更多次尝试才能达到这个概率。因此,在代码中,最大尝试次数(MAX_TRIES)应该设置得比实际值大一些,以便在实际运行中达到P1的概率。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.
但注意的是,这种方法并不是数学上严格精确的,因为它依赖于尝试次数和随机性,由于随机性的本质,直接控制生成特定序列的概率为P1是比较困难的,因为这会涉及到复杂的概率计算。在实际情况中,可能需要通过多次运行程序并统计结果来校准MAX_TRIES的值,以便更精确地控制生成特定的汉字序列的概率。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.
假设活动中,主办方的意愿是现场有100个礼品,但是不知道具体多少个用户来参与这个集字活动,而这个问题没有办法通过以上设定集齐特定的汉字序列的概率来实现。为了解决上述技术问题,本申请实施例提供了一种资源分配方法、装置、资源分配设备及存储介质。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.
接下来结合附图,对本申请实施例提供的一种资源分配方法进行详细地介绍。Next, a resource allocation method provided in an embodiment of the present application is introduced in detail with reference to the accompanying drawings.
图1是本申请实施例提供的一种资源分配方法的流程图,应用于资源分配设备,该资源分配设备可分配N种类型的网络资源,N为大于1的整数,如图1所示,该方法可以包括以下步骤:步骤101、步骤102、步骤103、步骤104和步骤105;FIG1 is a flow chart of a resource allocation method provided by an embodiment of the present application, which is applied to a resource allocation device, and the resource allocation device can allocate N types of network resources, where N is an integer greater than 1. As shown in FIG1 , the method may include the following steps: step 101, step 102, step 103, step 104, and step 105;
在步骤101中,接收目标场景内的第一用户发送的第一资源分配请求,其中,第一资源分配请求用于请求分配一个网络资源。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.
本申请实施例中,网络资源可以包括以下任意一项:图像、文字、视频、音频,应用场景比较广泛。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.
本申请实施例中,目标场景指的是任意涉及网络资源分配的场景,在实际应用中,目标场景可以是线上场景,也可以是线下场景,例如,线下扫码集齐特定的汉字序列的场景。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.
在一些实施例中,网络资源包括文字,N种类型的网络资源包括:N个不同的特定文字,目标场景是集齐N个不同的特定文字兑换礼品的场景,第一数量阈值是目标场景下礼品的数量值。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.
本申请实施例中,考虑到目标场景内通常有很多用户,一部分用户会参与资源分配活动,而另一部分用户不会参与资源分配活动,例如,在线下宣传活动场景中,一部分用户参与扫码集齐汉字活动,而另一部分用户只是单纯的逛逛,不参与集齐汉字活动。因此为了便于区分,将目标场景内参与资源分配活动的用户称为第一用户。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.
本申请实施例中,资源分配请求可以是用户通过自身所使用的电子设备,扫描目标场景内的条形码后触发该电子设备向资源分配设备发送的。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, which scans a barcode in a target scene and triggers the electronic device to send the request to the resource allocation device.
示例性地,条形码具体可以是二维码,如图2所示,很多用户(有可能是500人、有可能是1000人,也可能是其他人数)在线下参加“扫码集齐<博物馆奇妙夜>这一活动”,活动主办方提供了100份礼品。Exemplarily, the barcode may be a QR code. As shown in FIG2 , many users (possibly 500, 1,000, or any other number) participate in the "Scan the code to collect the "Night at the Museum" event offline", and the event organizer provides 100 gifts.
从用户的角度来说,用户1使用手机1每扫描一次二维码,获得一个汉字,多次扫码,获得多个汉字,同理,用户2使用手机2每扫描一次二维码,获得一个汉字,多次扫码,获得多个汉字,多个用户可以同时扫描一个二维码。From the user's perspective, each time user 1 scans the QR code using mobile phone 1, he obtains one Chinese character. By scanning the code multiple times, he obtains multiple Chinese characters. Similarly, each time user 2 scans the QR code using mobile phone 2, he obtains one Chinese character. By scanning the code multiple times, he obtains multiple Chinese characters. Multiple users can scan a QR code at the same time.
以用户1为例,用户1使用手机1每扫描一次二维码,触发手机1向云端的资源分配设备发送一次资源分配请求,资源分配设备响应资源分配请求,向手机1返回一个汉字,例如,用户1使用手机1依次扫码了3次,手机1依次向资源分配设备发送了3个资源分配请求,资源分配设备先后响应3次资源分配请求,返回了3个汉字,例如分别是“博、博、夜”。同理,用户2使用手机2扫码了4次,获得4分汉字,例如分别是“博、管、夜、物”。用户的期望是:通过多次扫码,获得的多个汉字能够组成“博物馆奇妙夜”,此时用户可以获得一份礼品。Take user 1 as an example. Every time user 1 scans the QR code with mobile phone 1, mobile phone 1 sends 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, user 1 scans the code three times with mobile phone 1. Mobile phone 1 sends three resource allocation requests to the resource allocation device. The resource allocation device responds to the three resource allocation requests and returns three Chinese characters, such as "博、博、夜". Similarly, user 2 scans the code four times with mobile phone 2 and obtains four Chinese characters, such as "博、管、夜、物". The user's expectation is that through multiple scans, the multiple Chinese characters obtained can form "Wonderful Night at the Museum", and the user can get a gift.
在步骤102中,响应于第一资源分配请求,根据第一概率,为第一用户分配一个网络资源,并将分配给第一用户的网络资源的类型信息记录到用户数据库中。In step 102, in response to a first resource allocation request, a network resource is allocated to a 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.
本申请实施例中,用户数据库中包括:各个第一用户已分配的各种网络资源的数量和各个网络资源所属的类型,第一概率是人为设定的第一用户集齐N种类型的网络资源的概率。In the embodiment of the present application, the user database includes: the number of various network resources allocated to each first user and the type of each network resource. The first probability is an artificially set probability that the first user has collected N types of network resources.
本申请实施例中,资源分配设备在接收到第一资源分配请求后,可以按照第一概率,随机生成一个网络资源,并将这个网络资源返回给第一用户,从而实现为第一用户分配一个网络资源。或者,如果资源分配设备内设置有资源池,资源池中预先存储有多个网络资源,则资源分配设备在接收到第一资源分配请求后,可以按照第一概率,从资源池中随机选择一个网络资源,并将这个网络资源返回给第一用户,从而实现为第一用户分配一个网络资源。In the embodiment of the present application, after receiving the first resource allocation request, the resource allocation device can randomly generate a network resource according to the first probability, and return the network resource to the first user, thereby allocating a network resource to the first user. Alternatively, if a resource pool is provided in the resource allocation device, and a plurality of network resources are pre-stored in the resource pool, then after receiving the first resource allocation request, the resource allocation device can randomly select a network resource from the resource pool according to the first probability, and return the network resource to the first user, thereby allocating a network resource to the first user.
在步骤103中,根据用户数据库,确定已集齐N种类型的网络资源的第一用户的数量是否达到第一数量阈值,若是,则设置N种类型的网络资源中特定类型的网络资源的分配次数。In step 103, it is determined according to the user database 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.
本申请实施例中,由于用户数据库中记录了各个第一用户已分配的各种网络资源的数量和各个网络资源所属的类型,因此根据用户数据库,可以准确地确定出已集齐N种类型的网络资源的第一用户的数量。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.
本申请实施例中,特定类型的网络资源可以是一种类型的网络资源,也可以是至少两种类型的网络资源。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.
本申请实施例中,第一数量阈值通常指的是人工预先设定的集齐N种类型的网络资源的用户的数量上限。例如,“扫码集齐<博物馆奇妙夜>这一活动”,活动主办方提供的礼品数量。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"".
本申请实施例中,在网络资源分配场景下,开始为目标场景内的各第一用户分配资源时,是按照设定的概率进行分配的,随着网络资源的不断分配,当集齐N种类型的网络资源的用户数量达到设定的数量上限时,通过控制某一特定网络资源的后续分配次数,来控制集齐N种类型的网络资源的用户数量。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.
在步骤104中,接收目标场景内的第一用户发送的第二资源分配请求,其中,第二资源分配请求用于请求分配一个网络资源。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.
本申请实施例中,虽然已经集齐N种类型的网络资源的用户数量已经达到了设定的数量上限,但是由于目标场景内用户数量通常较多,其他未集齐N种类型的网络资源的用户可能并不知道上述情况,仍然会继续参与资源分配活动,此时,这部分用户会继续向资源分配设备发送资源分配请求(即第二资源分配请求)。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.
在步骤105中,响应于第二资源分配请求,根据所设置的分配次数,为第一用户分配一个网络资源。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.
本申请实施例中,根据所设置的分配次数,为未集齐N种类型的网络资源的用户分配一个网络资源,使得该用户后续无法集齐N种网络资源,从而达到控制目标场景内集齐N种类型的网络资源的用户数量不超过设定的数量上限。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.
在一些实施例中,如图3所示,上述步骤105可以包括以下步骤:步骤301、步骤302和步骤303;In some embodiments, as shown in FIG3 , the above step 105 may include the following steps: step 301 , step 302 , and step 303 ;
在步骤301中,根据所设定的分配次数和第二概率,随机生成一个网络资源;其中,第二概率是人为设定的第一用户集齐N种类型的网络资源的概率。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.
本申请实施例中,第二概率与第一概率的数值可以相同,也可以不同。In the embodiment of the present application, the numerical values of the second probability and the first probability may be the same or different.
在步骤302中,根据用户数据库和随机生成的网络资源的类型信息,确定第三概率和特定类型的网络资源在已集齐N种类型的网络资源的第一用户的数量达到第一数量阈值之后的真实分配次数;其中,第三概率是第一用户集齐N种类型的网络资源的真实概率。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.
在步骤303中,根据第二概率、第三概率、所设置的分配次数和真实分配次数,为第一用户分配一个网络资源。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.
可选地,在特定类型的网络资源的类型数量是1的情况下,如图4所示,上述步骤303可以包括以下步骤:步骤3031、步骤3032、步骤3033和步骤3034;Optionally, when the number of types of network resources of a specific type is 1, as shown in FIG4 , the above step 303 may include the following steps: step 3031 , step 3032 , step 3033 , and step 3034 ;
在步骤3031中,确定第三概率是否小于或者等于第二概率;若是,则执行步骤3032,否则执行步骤3034。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.
在步骤3032中,确定真实分配次数是否小于或者等于所设置的分配次数;若是,则执行步骤3033,否则,执行步骤3034。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.
本申请实施例中,在第三概率小于或者等于第二概率的情况下,确定真实分配次数是否小于或者等于所设置的分配次数。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.
在步骤3033中,将随机选择的网络资源分配给第一用户,并将分配给第一用户的网络资源的类型信息记录到用户数据库中。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.
本申请实施例中,在真实分配次数小于或者等于所设置的分配次数的情况下,将随机选择的网络资源分配给第一用户,并将分配给第一用户的网络资源的类型信息记录到用户数据库中。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.
在步骤3034中,返回执行根据所设定的分配次数和第二概率,随机选择一个网络资源的步骤。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.
本申请实施例中,在第三概率大于第二概率,或者真实分配次数大于所设置的分配次数的情况下,返回执行上述步骤301。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.
可选地,在特定类型的网络资源的类型数量是M的情况下,M是大于1且小于N的整数,如图5所示,上述步骤303可以包括以下步骤:步骤3035、步骤3036、步骤3037和步骤3038;Optionally, in the case where the number of types of network resources of a specific type is M, M is an integer greater than 1 and less than N, as shown in FIG5 , the above step 303 may include the following steps: step 3035, step 3036, step 3037 and step 3038;
在步骤3035中,确定第三概率是否小于或者等于第二概率;若是,则执行步骤3036,否则执行步骤3038。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 .
在步骤3036中,确定M个特定类型的网络资源各自对应的真实分配次数是否均小于或者等于所设置的分配次数;若是,则执行步骤3037,否则执行步骤3038。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.
本申请实施例中,在第三概率小于或者等于第二概率的情况下,确定M个特定类型的网络资源各自对应的真实分配次数是否均小于或者等于所设置的分配次数。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.
在步骤3037中,将随机选择的网络资源分配给第一用户,并将分配给第一用户的网络资源的类型信息记录到用户数据库中。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.
本申请实施例中,在所有真实分配次数均小于或者等于所设置的分配次数的情况下,将随机选择的网络资源分配给第一用户,并将分配给第一用户的网络资源的类型信息记录到用户数据库中。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.
在步骤3038中,返回执行根据所设定的分配次数和第二概率,随机选择一个网络资源的步骤。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.
本申请实施例中,在第三概率大于第二概率,或者至少一个真实分配次数大于所设置的分配次数的情况下,返回执行上述步骤301。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.
由上述实施例可见,该实施例中,资源分配设备接收目标场景内的第一用户发送的第一资源分配请求,其中,第一资源分配请求用于请求分配一个网络资源;响应于第一资源分配请求,根据第一概率,为第一用户分配一个网络资源,并将分配给第一用户的网络资源的类型信息记录到用户数据库中,其中,用户数据库中包括:各个第一用户已分配的各种网络资源的数量和各个网络资源所属的类型,第一概率是人为设定的第一用户集齐N种类型的网络资源的概率;根据用户数据库,确定已集齐N种类型的网络资源的第一用户的数量是否达到第一数量阈值,若是,则设置N种类型的网络资源中特定类型的网络资源的分配次数;接收目标场景内的第一用户发送的第二资源分配请求,其中,第二资源分配请求用于请求分配一个网络资源;响应于第二资源分配请求,根据所设置的分配次数,为第一用户分配一个网络资源,从而实现在用户数量未知的情况下,为用户分配网络资源。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.
为了便于理解,下面结合一个具体的例子,对本申请实施例提供的资源分配方法进行详细举例说明。For ease of understanding, the resource allocation method provided in the embodiment of the present application is described in detail below with reference to a specific example.
网络资源包括文字,N种类型的网络资源包括:N个不同的特定文字,目标场景是集齐N个不同的特定文字兑换礼品的场景,第一数量阈值是目标场景下礼品的数量值。The network resources include texts. 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. The first quantity threshold is the quantity value of the gifts in the target scenario.
例如,N种类型的网络资源具体是“博物馆奇妙夜”这六个汉字,例如,在线下活动场景中,有1000个用户参与扫描二维码获取汉字的活动,活动主办方提供了100份礼品。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, 1,000 users participate in an activity of scanning a QR code to obtain the Chinese characters, and the event organizer provides 100 gifts.
活动主办方设定第一用户集齐N种类型的网络资源的初始概率是P2(即第一概率),1000个用户使用自己的手机不断地扫描活动场景内的二维码,资源分配设备按照概率P1,向1000个用户返回汉字,随着这些用户的不断扫码,用户不断地从资源分配设备获得汉字,越来越多的用户集齐了“博物馆奇妙夜”这六个汉字。在资源分配设备检测到集齐“博物馆奇妙夜”这六个汉字的用户数量达到礼品数量100时,则会启用后端代码来干扰“博物馆奇妙夜”这六个汉字中某一个汉字的分配次数,例如,控制“博物馆奇妙夜”这六个汉字中的“奇”的分配次数,以控制成功次数是100,通过该方法既可以达到控制用户集齐汉字的数量上限也不会影响用户体验。The event organizer sets the initial probability of the first user collecting N types of network resources to P2 (i.e., the first probability). 1,000 users use their mobile phones to continuously scan the QR code in the event scene. The resource allocation device returns Chinese characters to the 1,000 users according to the probability P1. As these users continue to scan the code, they continue to obtain Chinese characters from the resource allocation device, and more and more users have collected the six Chinese characters of "Wonderful Night at the Museum". When the resource allocation device detects that the number of users who have collected the six Chinese characters of "Wonderful Night at the Museum" reaches the number of gifts of 100, the backend code will be enabled to interfere with the number of allocations of one of the six Chinese characters of "Wonderful Night at the Museum". For example, the number of allocations of "奇" in the six Chinese characters of "Wonderful Night at the Museum" is controlled to control the number of successes to 100. This method can achieve the upper limit of the number of Chinese characters that users can collect without affecting the user experience.
如图6所示,示出了通过控制某一汉字的分配次数,来控制集齐特定的汉字序列的过程,可以包括以下步骤:步骤601、步骤602、步骤603、步骤604、步骤605、步骤606和步骤607;As shown in FIG6 , the process of controlling the collection of a specific Chinese character sequence by controlling the number of times a certain Chinese character is allocated may include the following steps: step 601, step 602, step 603, step 604, step 605, step 606 and step 607;
在步骤601中,确定目标汉字序列。例如“博物馆奇妙夜”。In step 601, a target Chinese character sequence is determined, such as "Night at the Museum".
在步骤602中,设置目标汉字序列被集齐的初始概率P2。In step 602, an initial probability P2 of the target Chinese character sequence being collected is set.
在步骤603中,设置某一特定汉字的分配次数为K;其中,K=1,……。例如,“奇”字的分配次数为2。In step 603, the allocation times of a certain Chinese character is set to K, wherein K=1, ... For example, the allocation times of the character "奇" is 2.
在步骤604中,根据概率P2和K,随机生成汉字。In step 604, Chinese characters are randomly generated according to the probabilities P2 and K.
在步骤605中,根据最终的实际生成汉字的结果,计算目标汉字序列被集齐的实际概率P3。In step 605, based on the final result of actually generating Chinese characters, the actual probability P3 of the target Chinese character sequence being collected is calculated.
在步骤606中,判断P3是否小于或者等于P2,如果是,判断特定汉字真实的分配次数是否大于K,如果是,再递归执行步骤602;否则,执行步骤607。In step 606, determine whether P3 is less than or equal to P2. If so, determine whether the actual number of allocations of the specific Chinese character is greater than K. If so, recursively execute step 602; otherwise, execute step 607.
在步骤607中,将随机生成的汉字返回给用户,并更新用户数据库。In step 607, the randomly generated Chinese characters are returned to the user and the user database is updated.
如果采用java代码编写上述过程,getRandomHanzi方法将生成的是随机的汉字字符,而不仅仅是“博物馆奇妙夜”中的字符,因此想要生成的随机汉字仅限于“博物馆奇妙夜”等几个特定的汉字,需要修改getRandomHanzi方法,让它仅从这个有限的字符集中选择。If the above process is written in Java code, the getRandomHanzi method will generate random Chinese characters, not just the characters in "Night at the Museum". Therefore, if the random Chinese characters you want to generate are limited to a few specific Chinese characters such as "Night at the Museum", you need to modify the getRandomHanzi method so that it only selects from this limited character set.
首先确保生成的序列总是包含“博物馆奇妙夜”这六个字(只是“奇”字的数量是固定的),然后将“博物馆奇妙夜”中的其他汉字先添加到序列中,通过在函数体内采用某个参数检查是否应该避免生成包含过多“奇”字符的结果。函数的具体逻辑和概率设置如下:First, make sure that the generated sequence always contains the six characters "Museum Night" (only the number of "odd" characters is fixed), then add the other Chinese characters in "Museum Night" to the sequence, and use a parameter in the function body to check whether to avoid generating results containing too many "odd" characters. The specific logic and probability settings of the function are as follows:
function randomFun(){function randomFun(){
var yecount=context.getArg('yecount');var yecount=context.getArg('yecount');
var str='博物馆奇妙夜';var str = 'Night at the Museum';
var result=”;var result = ";
var totalProbability=0.12;var totalProbability=0.12;
for(var i=0;i<str.length;i++){for(var i=0;i<str.length;i++){
var randomNum=Math.random();var randomNum=Math.random();
var charProbability=1/(str.length-i);//计算每个字符的概率var charProbability = 1/(str.length-i); //Calculate the probability of each character
if(randomNum<=totalProbability){if(randomNum<=totalProbability){
result+=str.charAt(i);result += str.charAt(i);
totalProbability-=charProbability;totalProbability-=charProbability;
if(result=='奇'&&yecount>100){if(result == 'odd' &&yecount>100){
result='博';//这里重新运行randomFun()循环或递归调用函数来生成新的随机子串,可能是最佳的设计选择。result = '博'; // Re-running the randomFun() loop or recursively calling the function to generate new random substrings may be the best design choice.
}}
context.setReturn('suijijieguo',result);context.setReturn('suijijieguo',result);
return;return;
}}
}}
if(result==”){if(result==”){
randomFun();randomFun();
}}
}}
randomFun();randomFun();
这段JavaScript代码实现了一个名为randomFun的函数,该函数的目标是随机地生成一个由给定字符串“博物馆奇妙夜”中的字符组成的子串。其中,输入参数:函数接受一个名为yecount的参数,这个参数在函数体内被用来检查是否应该避免生成包含过多“奇”字符的结果。初始化:str变量存储了要从中随机选择字符的原始字符串“博物馆奇妙夜”,result变量用来存储最终生成的随机子串,totalProbability变量设置为0.12,代表初始的随机选择概率。循环:函数通过一个for循环遍历str中的每个字符。随机选择与概率:在每次循环中,生成一个0到1之间的随机数randomNum;计算当前字符被选中的概率charProbability,它是1除以剩余未选择字符的数量。字符选择:如果randomNum小于或等于totalProbability,则选择当前字符并将其添加到result中;每次选择一个字符后,totalProbability都会减去charProbability,这样随着循环的进行,选择下一个字符的概率会逐渐降低。特殊条件:如果生成的result恰好是“奇”,并且yecount大于100,那么将result重置为“博”。这可以看作是一种避免生成过多相同字符的策略。返回结果:一旦选择了一个字符,函数会通过context.setReturn('suijijieguo',result)设置一个返回值,并通过return语句结束函数执行,这个函数试图实现一个基于概率的随机子串生成器。This JavaScript code implements a function called randomFun, whose goal is to randomly generate a substring consisting of the characters in the given string "Night at the Museum". Input parameters: The function accepts a parameter called yecount, which is used in the function body to check whether to avoid generating results containing too many "odd" characters. Initialization: The str variable stores the original string "Night at the Museum" from which characters are to be randomly selected, the result variable is used to store the final random substring, and the totalProbability variable is set to 0.12, representing the initial random selection probability. Loop: The function iterates over 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; each time a character is selected, charProbability is subtracted from totalProbability, so that as the loop progresses, the probability of selecting the next character gradually decreases. Special condition: If the generated result happens to be "奇", and yecount is greater than 100, then reset result to "博". This can be seen 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.
可见,本申请实施例中,通过控制某一个参数的次数来控制业务当中需要控制的整体成功次数,以及通过Java Collections shuffle方法实现随机性对列表元素进行随机重新排序来工作,保证了业务预定的随机性和上限次数,从而解决各种宣传业务场景下无法控制成功次数的问题,提高用户体验并确保中奖率。It can be seen that in the embodiments of the present application, the overall number of successes that need to be controlled in the business is controlled by controlling the number of times a certain parameter is controlled, and the random reordering of list elements is achieved through the Java Collections shuffle method to ensure the randomness and upper limit of the business predetermined number of times, thereby solving the problem of being unable to control the number of successes in various promotional business scenarios, improving user experience and ensuring the winning rate.
相应于上面的方法实施例,本申请实施例还提供了一种资源分配装置,下文描述的资源分配装置与上文描述的资源分配方法可相互对应参照。Corresponding to the above method embodiment, the embodiment of the present application further provides a resource allocation device. The resource allocation device described below and the resource allocation method described above can refer to each other.
图7是本申请实施例提供的一种资源分配装置的结构示意图,应用于资源分配设备,所述资源分配设备可分配N种类型的网络资源,N为大于1的整数,如图7所示,所述资源分配装置700,可以包括:第一接收模块701、第一分配模块702、确定模块703、设置模块704、第二接收模块705和第二分配模块706;FIG7 is a schematic diagram of the 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. As shown in FIG7 , 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;
第一接收模块701,用于接收目标场景内的第一用户发送的第一资源分配请求,其中,所述第一资源分配请求用于请求分配一个网络资源;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;
第一分配模块702,用于响应于所述第一资源分配请求,根据第一概率,为所述第一用户分配一个网络资源,并将分配给所述第一用户的网络资源的类型信息记录到用户数据库中,其中,所述用户数据库中包括:各个所述第一用户已分配的各种网络资源的数量和各个网络资源所属的类型,所述第一概率是人为设定的所述第一用户集齐所述N种类型的网络资源的概率;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 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 of the N types of network resources;
确定模块703,用于根据所述用户数据库,确定已集齐所述N种类型的网络资源的第一用户的数量是否达到第一数量阈值;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;
设置模块704,用于在已集齐所述N种类型的网络资源的第一用户的数量达到第一数量阈值的情况下,设置所述N种类型的网络资源中特定类型的网络资源的分配次数;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;
第二接收模块705,用于接收所述目标场景内的第一用户发送的第二资源分配请求,其中,所述第二资源分配请求用于请求分配一个网络资源;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;
第二分配模块706,用于响应于所述第二资源分配请求,根据所设置的分配次数,为所述第一用户分配一个网络资源。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.
由上述实施例可见,该实施例中,资源分配设备接收目标场景内的第一用户发送的第一资源分配请求,其中,第一资源分配请求用于请求分配一个网络资源;响应于第一资源分配请求,根据第一概率,为第一用户分配一个网络资源,并将分配给第一用户的网络资源的类型信息记录到用户数据库中,其中,用户数据库中包括:各个第一用户已分配的各种网络资源的数量和各个网络资源所属的类型,第一概率是人为设定的第一用户集齐N种类型的网络资源的概率;根据用户数据库,确定已集齐N种类型的网络资源的第一用户的数量是否达到第一数量阈值,若是,则设置N种类型的网络资源中特定类型的网络资源的分配次数;接收目标场景内的第一用户发送的第二资源分配请求,其中,第二资源分配请求用于请求分配一个网络资源;响应于第二资源分配请求,根据所设置的分配次数,为第一用户分配一个网络资源,从而实现在用户数量未知的情况下,为用户分配网络资源。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.
可选地,作为一个实施例,所述第二分配模块706,可以包括:Optionally, as an embodiment, the second allocation module 706 may include:
生成子模块,用于根据所设定的分配次数和第二概率,随机生成一个网络资源,其中,所述第二概率是人为设定的所述第一用户集齐所述N种类型的网络资源的概率;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;
确定子模块,用于根据所述用户数据库和随机生成的网络资源的类型信息,确定第三概率和所述特定类型的网络资源在已集齐所述N种类型的网络资源的第一用户的数量达到第一数量阈值之后的真实分配次数,其中,所述第三概率是所述第一用户集齐所述N种类型的网络资源的真实概率;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;
分配子模块,用于根据所述第二概率、所述第三概率、所设置的分配次数和所述真实分配次数,为所述第一用户分配一个网络资源。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.
可选地,作为一个实施例,所述特定类型的网络资源的类型数量是1;Optionally, as an embodiment, the number of types of the specific type of network resources is 1;
所述分配子模块,可以包括:The allocation submodule may include:
第一确定单元,用于确定所述第三概率是否小于或者等于所述第二概率;A first determining unit, configured to determine whether the third probability is less than or equal to the second probability;
第二确定单元,用于若所述第三概率小于或者等于所述第二概率,则确定所述真实分配次数是否小于或者等于所设置的分配次数;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;
第一分配单元,用于若所述真实分配次数小于或者等于所设置的分配次数,则将所述随机选择的网络资源分配给所述第一用户,并将分配给所述第一用户的网络资源的类型信息记录到用户数据库中;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;
第一循环单元,用于若所述第三概率大于所述第二概率,或者所述真实分配次数大于所设置的分配次数,则返回执行根据所设定的分配次数和所述第二概率,随机选择一个网络资源的步骤。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.
可选地,作为一个实施例,所述特定类型的网络资源的类型数量是M,M是大于1且小于N的整数;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;
所述分配子模块,可以包括:The allocation submodule may include:
第三确定单元,用于确定所述第三概率是否小于或者等于所述第二概率;a third determining unit, configured to determine whether the third probability is less than or equal to the second probability;
第四确定单元,用于若所述第三概率小于或者等于所述第二概率,则确定所述M个特定类型的网络资源各自对应的所述真实分配次数是否均小于或者等于所设置的分配次数;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;
第二分配单元,用于若所有所述真实分配次数均小于或者等于所设置的分配次数,则将所述随机选择的网络资源分配给所述第一用户,并将分配给所述第一用户的网络资源的类型信息记录到用户数据库中;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;
第二循环单元,用于若所述第三概率大于所述第二概率,或者至少一个所述真实分配次数大于所设置的分配次数,则返回执行根据所设定的分配次数和所述第二概率,随机选择一个网络资源的步骤。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.
可选地,作为一个实施例,所述资源分配请求是用户通过自身所使用的电子设备,扫描所述目标场景内的条形码后触发所述电子设备向所述资源分配设备发送的。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.
可选地,作为一个实施例,所述网络资源可以包括以下任意一项:图像、文字、视频、音频。Optionally, as an embodiment, the network resource may include any one of the following: image, text, video, audio.
可选地,作为一个实施例,所述网络资源包括文字;所述N种类型的网络资源包括:N个不同的特定文字;所述目标场景是集齐所述N个不同的特定文字兑换礼品的场景,所述第一数量阈值是所述目标场景下礼品的数量值。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.
关于上述实施例中的装置,其中各个模块执行操作的具体方式已经在有关该方法的实施例中进行了详细描述,此处将不做详细阐述说明。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.
相应于上面的方法实施例,本申请实施例还提供了一种资源分配设备,包括:存储器,用于存储计算机程序;处理器,用于执行所述计算机程序时实现上述资源分配方法的步骤。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.
如图8所示,为资源分配设备的组成结构示意图,资源分配设备可以包括:处理器810、存储器820、通信接口830和通信总线840。处理器810、存储器820、通信接口830均通过通信总线840完成相互间的通信。As shown in FIG8 , it 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 all communicate with each other through the communication bus 840 .
在本申请实施例中,处理器810可以为中央处理器(Central Processing Unit,CPU)、特定应用集成电路、数字信号处理器、现场可编程门阵列或者其他可编程逻辑器件等。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.
处理器810可以调用存储器820中存储的程序,具体的,处理器810可以执行系统管理方法的实施例中的操作。存储器820中用于存放一个或者一个以上程序,程序可以包括程序代码,程序代码包括计算机操作指令,在本申请实施例中,存储器820中至少存储有用于实现以下功能的程序: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:
接收目标场景内的第一用户发送的第一资源分配请求,其中,所述第一资源分配请求用于请求分配一个网络资源;响应于所述第一资源分配请求,根据第一概率,为所述第一用户分配一个网络资源,并将分配给所述第一用户的网络资源的类型信息记录到用户数据库中,其中,所述用户数据库中包括:各个所述第一用户已分配的各种网络资源的数量和各个网络资源所属的类型,所述第一概率是人为设定的所述第一用户集齐所述N种类型的网络资源的概率;根据所述用户数据库,确定已集齐所述N种类型的网络资源的第一用户的数量是否达到第一数量阈值,若是,则设置所述N种类型的网络资源中特定类型的网络资源的分配次数;接收所述目标场景内的第一用户发送的第二资源分配请求,其中,所述第二资源分配请求用于请求分配一个网络资源;响应于所述第二资源分配请求,根据所设置的分配次数,为所述第一用户分配一个网络资源。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.
在一种可能的实现方式中,存储器820可包括存储程序区和存储数据区,其中,存储程序区可存储操作系统,以及至少一个功能所需的应用程序等;存储数据区可存储使用过程中所创建的数据。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.
此外,存储器820可以包括高速随机存取存储器,还可以包括非易失性存储器,例如至少一个磁盘存储器件或其他易失性固态存储器件。通信接口830可以为通信模块的接口,用于与其他设备或者系统连接。当然,需要说明的是,图8所示的结构并不构成对本申请实施例中资源分配设备的限定,在实际应用中资源分配设备可以包括比图8所示的更多或更少的部件,或者组合某些部件。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 the structure shown in FIG8 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 more or fewer components than those shown in FIG8, or combine certain components.
相应于上面的方法实施例,本申请实施例还提供了一种计算机可读存储介质,计算机可读存储介质上存储有计算机程序,所述计算机程序被处理器执行时实现上述资源分配方法的步骤。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.
此外,需要说明的是,本申请实施例还提供了一种计算机程序产品或计算机程序,该计算机程序产品或者计算机程序可以包括计算机指令,该计算机指令可以存储在计算机可读存储介质中。计算机设备的处理器从计算机可读存储介质读取该计算机指令,处理器可以执行该计算机指令,使得该计算机设备执行前文所对应实施例中资源分配方法的描述,因此,这里将不再进行赘述。另外,对采用相同方法的有益效果描述,也不再进行赘述。对于本申请所涉及的计算机程序产品或者计算机程序实施例中未披露的技术细节,请参照本申请方法实施例的描述。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.
本说明书中各个实施例采用递进的方式描述,每个实施例重点说明的都是与其它实施例的不同之处,各个实施例之间相同或相似部分互相参见即可。专业人员还可以进一步意识到,结合本文中所公开的实施例描述的各示例的单元及算法步骤,能够以电子硬件、计算机软件或者二者的结合来实现,为了清楚地说明硬件和软件的可互换性,在上述说明中已经按照功能一般性地描述了各示例的组成及步骤。这些功能究竟以硬件还是软件方式来执行,取决于技术方案的特定应用和设计约束条件。专业技术人员可以对每个特定的应用来使用不同方法来实现所描述的功能,但是这种实现不应认为超出本申请的范围。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.
结合本文中所公开的实施例描述的方法或算法的步骤可以直接用硬件、处理器执行的软件模块,或者二者的结合来实施。软件模块可以置于随机存储器(RAM)、内存、只读存储器(ROM)、电可编程ROM、电可擦除可编程ROM、寄存器、硬盘、可移动磁盘、CD-ROM、或技术领域内所公知的任意其它形式的存储介质中。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.
本文中应用了具体个例对本申请的原理及实施方式进行了阐述,以上实施例的说明只是用于帮助理解本申请的技术方案及其核心思想。应当指出,对于本技术领域的普通技术人员来说,在不脱离本申请原理的前提下,还可以对本申请进行若干改进和修饰,这些改进和修饰也落入本申请权利要求的保护范围内。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 (10)
Priority Applications (1)
Application Number | Priority Date | Filing Date | Title |
---|---|---|---|
CN202410962550.5A CN118972438A (en) | 2024-07-17 | 2024-07-17 | Resource allocation method, device, resource allocation equipment and storage medium |
Applications Claiming Priority (1)
Application Number | Priority Date | Filing Date | Title |
---|---|---|---|
CN202410962550.5A CN118972438A (en) | 2024-07-17 | 2024-07-17 | Resource allocation method, device, resource allocation equipment and storage medium |
Publications (1)
Publication Number | Publication Date |
---|---|
CN118972438A true CN118972438A (en) | 2024-11-15 |
Family
ID=93382574
Family Applications (1)
Application Number | Title | Priority Date | Filing Date |
---|---|---|---|
CN202410962550.5A Pending CN118972438A (en) | 2024-07-17 | 2024-07-17 | Resource allocation method, device, resource allocation equipment and storage medium |
Country Status (1)
Country | Link |
---|---|
CN (1) | CN118972438A (en) |
Citations (6)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
CN1910630A (en) * | 2004-01-08 | 2007-02-07 | Igt公司 | Matching bonus method using player tracking card |
JP2016026554A (en) * | 2014-06-27 | 2016-02-18 | 株式会社三共 | Game machine |
CN111614836A (en) * | 2020-05-21 | 2020-09-01 | 斑马网络技术有限公司 | Interaction method based on screen saver of vehicle terminal |
CN112188297A (en) * | 2020-09-08 | 2021-01-05 | 腾讯科技(深圳)有限公司 | Live broadcast interaction method and device, electronic equipment and storage medium |
CN116521323A (en) * | 2023-05-25 | 2023-08-01 | 北京陌陌信息技术有限公司 | A virtual resource allocation method, device and storage device |
CN116800834A (en) * | 2023-08-28 | 2023-09-22 | 深圳有咖互动科技有限公司 | Virtual gift merging method, device, electronic equipment and computer readable medium |
-
2024
- 2024-07-17 CN CN202410962550.5A patent/CN118972438A/en active Pending
Patent Citations (6)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
CN1910630A (en) * | 2004-01-08 | 2007-02-07 | Igt公司 | Matching bonus method using player tracking card |
JP2016026554A (en) * | 2014-06-27 | 2016-02-18 | 株式会社三共 | Game machine |
CN111614836A (en) * | 2020-05-21 | 2020-09-01 | 斑马网络技术有限公司 | Interaction method based on screen saver of vehicle terminal |
CN112188297A (en) * | 2020-09-08 | 2021-01-05 | 腾讯科技(深圳)有限公司 | Live broadcast interaction method and device, electronic equipment and storage medium |
CN116521323A (en) * | 2023-05-25 | 2023-08-01 | 北京陌陌信息技术有限公司 | A virtual resource allocation method, device and storage device |
CN116800834A (en) * | 2023-08-28 | 2023-09-22 | 深圳有咖互动科技有限公司 | Virtual gift merging method, device, electronic equipment and computer readable medium |
Similar Documents
Publication | Publication Date | Title |
---|---|---|
CN109951547B (en) | Transaction request parallel processing method, device, equipment and medium | |
CN112767133B (en) | Service decision method and device, storage medium and computer equipment | |
US9251466B2 (en) | Driving an interactive decision service from a forward-chaining rule engine | |
WO2014194695A1 (en) | Method and server for pvp team matching in computer games | |
US20090298594A1 (en) | Media/tag-based word games | |
CN112306471A (en) | Task scheduling method and device | |
JP2005517243A (en) | Data logging for resident applications in portable electronic devices | |
CN113412481B (en) | Resource pushing method, device, server and storage medium | |
US20230394330A1 (en) | A method and system for designing ai modeling processes based on graph algorithms | |
CN107807935B (en) | Using recommended method and device | |
CN119415273A (en) | Reasoning service management method, device, medium and computer program product | |
CN108399333A (en) | System and method for the anti-virus scan for executing webpage | |
CN112214506A (en) | Information acquisition method and device and storage medium | |
CN107493315A (en) | A kind of collection method of behavioral data, Resource Server and storage medium | |
CN107281754B (en) | A kind of application identities matching process and its equipment, storage medium, server | |
CN118972438A (en) | Resource allocation method, device, resource allocation equipment and storage medium | |
CN108632387A (en) | Generate the method, apparatus and terminal of game reservation message | |
CN114819942B (en) | Block chain-based game processing method, device, equipment and storage medium | |
CN107277640A (en) | Interactive approach, device and storage medium based on live platform | |
US9149725B2 (en) | Method and server for PVP team matching in computer games | |
CN111142868A (en) | Method and device for developing movable winning system | |
CN112541548B (en) | Method, device, computer equipment and storage medium for generating relational network | |
CN110191460B (en) | New network access user monitoring method and platform | |
CN113032762A (en) | Login password setting method and device for marking software, storage medium and terminal | |
CN111580975A (en) | Memory optimization method and system for speech synthesis |
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 |