Looking for breakthrough ideas for innovation challenges? Try Patsnap Eureka!

A method and device for generating random numbers

A random number and random generation technology, applied in the electronic field, can solve the problem of low efficiency of random number generation

Active Publication Date: 2020-04-24
GUANGZHOU KUGOU COMP TECH CO LTD
View PDF6 Cites 0 Cited by
  • Summary
  • Abstract
  • Description
  • Claims
  • Application Information

AI Technical Summary

Problems solved by technology

[0006] In order to overcome the problem of low generation efficiency of random numbers in related technologies, the present disclosure provides a method and device for generating random numbers

Method used

the structure of the environmentally friendly knitted fabric provided by the present invention; figure 2 Flow chart of the yarn wrapping machine for environmentally friendly knitted fabrics and storage devices; image 3 Is the parameter map of the yarn covering machine
View more

Image

Smart Image Click on the blue labels to locate them in the text.
Viewing Examples
Smart Image
  • A method and device for generating random numbers
  • A method and device for generating random numbers
  • A method and device for generating random numbers

Examples

Experimental program
Comparison scheme
Effect test

Embodiment Construction

[0042] Reference will now be made in detail to the exemplary embodiments, examples of which are illustrated in the accompanying drawings. When the following description refers to the accompanying drawings, the same numerals in different drawings refer to the same or similar elements unless otherwise indicated. The implementations described in the following exemplary examples do not represent all implementations consistent with the present disclosure. Rather, they are merely examples of apparatuses and methods consistent with aspects of the present disclosure as recited in the appended claims.

[0043] An exemplary embodiment of the present disclosure provides a method for generating a random number, which can be used in a terminal or a server. The terminal or server may be provided with a processor and a memory, the processor may be used for related processing of generating a floating-point random number with a first preset number of digits, and the memory may be used for sto...

the structure of the environmentally friendly knitted fabric provided by the present invention; figure 2 Flow chart of the yarn wrapping machine for environmentally friendly knitted fabrics and storage devices; image 3 Is the parameter map of the yarn covering machine
Login to View More

PUM

No PUM Login to View More

Abstract

The invention relates to a random number generation method and apparatus, and belongs to the technical field of electronics. The method comprises the steps of randomly generating a first integer with a first preset digit number; by performing logic operation on the first integer and a preset numerical value, converting the first integer into a first floating point number located in a first preset range, wherein the first preset range is [0.5,1) or (-1,-0.5]; according to an assignment bzhi instruction and a numerical value of the highest digit of the first integer, obtaining a second floating point number, wherein the second floating point number is zero or a range adjustment offset; and performing addition on the first floating point number and the second floating point number to obtain a floating point number having the first preset digit number and located in a second preset range, and taking the floating point number as a random number generation result, wherein the second preset range is [0,1). By adopting the method and the apparatus, the random number generation efficiency can be improved.

Description

technical field [0001] The present disclosure relates to the field of electronic technology, in particular to a method and device for generating random numbers. Background technique [0002] With the development of electronic technology, terminals such as mobile phones and computers have been widely used, and corresponding terminal functions have become more and more abundant. When the terminal implements certain functions, it often needs to generate random numbers, such as generating 64-bit double-precision floating-point numbers between [0,1). [0003] The method of generating a 64-bit double-precision floating-point number between [0,1) is generally: generate a 64-bit integer random number, then use the cvtsi2sd instruction to convert the 64-bit integer random number into a floating-point random number, and finally convert The converted floating-point random number is multiplied by the quotient of 1 and the maximum value among 64-bit double-precision floating-point numbe...

Claims

the structure of the environmentally friendly knitted fabric provided by the present invention; figure 2 Flow chart of the yarn wrapping machine for environmentally friendly knitted fabrics and storage devices; image 3 Is the parameter map of the yarn covering machine
Login to View More

Application Information

Patent Timeline
no application Login to View More
Patent Type & Authority Patents(China)
IPC IPC(8): G06F7/58
CPCG06F7/588
Inventor 谭健文
Owner GUANGZHOU KUGOU COMP TECH CO LTD
Who we serve
  • R&D Engineer
  • R&D Manager
  • IP Professional
Why Patsnap Eureka
  • Industry Leading Data Capabilities
  • Powerful AI technology
  • Patent DNA Extraction
Social media
Patsnap Eureka Blog
Learn More
PatSnap group products