Welcome guest. Before posting on our computer help forum, you must register. Click here it's easy and free.

Author Topic: Generating pseudo-random integers programming language  (Read 6217 times)

0 Members and 1 Guest are viewing this topic.

Handsonic

    Topic Starter


    Newbie

    • Experience: Familiar
    • OS: Windows 10
    Generating pseudo-random integers programming language
    « on: May 26, 2017, 04:00:43 PM »
    Hello,

    I have time seeking to learn a programming language to make a project that I have some time thinking. I would like to get language that allows me to generate random (pseudo) integers and according to the numbers generated, generate an image e.g. the numbers 1 gets generated then picture number 1 will get generated and so on. I would like to do that in different patterns. Right now I'm trying to do that with Python, but I'm facing some issues. Which program would you recommend? I'm a total beginner regarding computer languages. Thanks,

    PS: I also would like to get the number deleted after generated to avoid getting run out of memory.

    Geek-9pm


      Mastermind
    • Geek After Dark
    • Thanked: 1026
      • Gekk9pm bnlog
    • Certifications: List
    • Computer: Specs
    • Experience: Expert
    • OS: Windows 10
    Re: Generating pseudo-random integers programming language
    « Reply #1 on: May 26, 2017, 05:23:03 PM »
    You want to create integer numbers in a short range - right?
    Do you want series that never repeats?
    For showing images, it should not matter if it repeats after awhile
    A method often used is to use a fraction that does not repeat when expressed as a decimal.It does not take much memory. The numbers are not huge. Just the decimal expression goes on forever.
    Look here:
    https://docs.python.org/2/library/random.html
    Quote
    This module implements pseudo-random number generators for various distributions.

    For integers, uniform selection from a range. For sequences, uniform selection of a random element, a function to generate a random permutation of a list in-place, and a function for random sampling without replacement.

    On the real line, there are functions to compute uniform, normal (Gaussian), lognormal, negative exponential, gamma, and beta distributions. For generating distributions of angles, the von Mises distribution is available.

    Almost all module functions depend on the basic function random(), which generates a random float uniformly in the semi-open range [0.0, 1.0). Python uses the Mersenne Twister as the core generator. It produces 53-bit precision floats and has a period of 2**19937-1. The underlying implementation in C is both fast and threadsafe. The Mersenne Twister is one of the most extensively tested random number generators in existence. However, being completely deterministic, it is not suitable for all purposes, and is completely unsuitable for cryptographic purposes.
    Most of that is way beyond what you need.  Just a simple random number is all you need. The other stuff is for people doing deep statistical studies.
    You will not run out of memory. And if you do, Python will let you know.

    camerongray



      Expert
    • Thanked: 306
      • Yes
      • Cameron Gray - The Random Rambings of a Computer Geek
    • Certifications: List
    • Computer: Specs
    • Experience: Expert
    • OS: Mac OS
    Re: Generating pseudo-random integers programming language
    « Reply #2 on: May 26, 2017, 07:20:57 PM »
    You'll need to explain what you are trying to do in more detail.  Are these images premade and you'll just pick them at random or are you wanting to generate images by using the random data to define the colours of each pixel at random?