How do you guys limit rand() results to a range?

Discussion in 'C Programming' started by DFS, Jun 1, 2014.

  1. (snip, I wrote)
    Thinking about it again, the coupling between the two, classically,
    is the probability of the particle emitted from one hitting the other.
    That makes the argement for it being squared more obvious.
    Yes. About the only point I was trying to make is that in quantum
    mechanics things are rarely infinite and rarely zero, but instead
    really huge and really tiny.

    OK, but it is a slightly different problem. To make EPR tests work,
    you have to be careful that you don't disturb the quantum state.

    For quantum randomness, you want the systems to be uncoupled, but
    will find that there is (a very small amount) of coupling.
    More specifically, and the experiment that took longer to do than
    some other ones, two particles can be created coupled, separated
    in distance, and then have their state measured. Even when the
    time between the two measurements is less than the distance
    bewteen them divided by c, (so that no signal could propagate)
    they are still found to keep their state.
    Yes. The point that I was trying to make, with a very simplified
    example, is that quantum systems, like PRNGs, have a finite number
    of states. It might be a really huge number, though.

    And then you have to extract some of that state information and
    generate bits from it.

    -- glen
    glen herrmannsfeldt, Jun 4, 2014
    1. Advertisements

  2. DFS

    Stefan Ram Guest

    Nowhere in EPR 1935 have they »tried to interpret quantum
    uncertainty as being due to "hidden variables"«.
    Stefan Ram, Jun 4, 2014
    1. Advertisements

  3. DFS

    James Kuyper Guest

    The first message in this thread in which I used any variation on the
    term "really-random" was the one with the header "Date: Tue, 03 Jun 2014
    22:21:21 -0400". It was in response to your message more than an hour
    earlier, with the header "Date: 4 Jun 2014 01:19:02 GMT". Whatever your
    point was in your earlier message (which I remain unclear about) it
    could not have been about my use of the term "really-random". Up to that
    point, I had never bothered distinguishing pseudo-random and
    really-random processes, the distinction being irrelevant to the issues
    under discussion.
    James Kuyper, Jun 4, 2014
  4. DFS

    Stefan Ram Guest

    Obviously not all quantum systems have a finite number of
    states, often the space of their states (as rays in Hilbert
    space) even has an infinite number of dimensions!
    Stefan Ram, Jun 4, 2014
  5. DFS

    James Kuyper Guest

    On 06/04/2014 05:59 PM, Stefan Ram wrote:
    Which was in response to your comment about "When one is using »real«
    random numbers,".
    Your comment applied the attribute "real random" to "numbers", just like
    my later comment applied the attribute "really-random" to "numbers" -
    neither comment clarifies that it's actually the source that's random,
    and not the numbers themselves. I'll readily concede that, ideally, the
    clarification should be made. However, what is the distinction that
    makes your comment acceptable, and mine not?
    James Kuyper, Jun 4, 2014
  6. DFS

    James Kuyper Guest

    Assume that, knowing the first N numbers, the exact algorithm, and
    complete internal state, you could determine upper and lower limits on
    the next number - but that it was impossible to determine which number
    within that range would be generated - would you consider that a
    deterministic system? I sure wouldn't.

    I think you're talking about the probabilities being exactly even, not
    about the selection from among those probabilities being random. Those
    are two entirely distinct issues, as far as I'm concerned.
    James Kuyper, Jun 4, 2014
  7. DFS

    Stefan Ram Guest

    What I wrote in



    |One cannot just assume that there are »real« random numbers,
    |because the statistical properties of random numbers obtain
    |from real quantum random number generators are different than
    |the statistical properties of random numbers obtain from real
    |classical random number generators, even if both are not
    |pseudo-random number generators.

    . So I was using the noun phrase in the negative: I wrote

    »One can/not/ just assume that there are ...«.

    Also, to further dissociate myself from that attribute »real«
    and mark it as a kind of quotation of a wording some people
    might use, I wrapped it in quotation marks.


    My point was that we had dices and coins even before the
    20th century. There are classical sources of randomness such
    as the bean machine (Galton box) or the roulette wheel, that
    one really cannot predict and which deliver a certain
    distribution of frequencies.

    Dices and coins usually are random enough to be deemed
    sources of randomness. I will call them »classical sources«

    However, today we also have quantum sources of randomness,
    and we know that they have different properties than
    classical sources.

    So today, one cannot just use the term »real source«
    anymore, because we have two kinds of real sources with
    different properties, but both so random that they can be
    used for gambling houses and lotteries, where some people
    would lose a lot of money where the sources of randomness
    predictable or biased in some way.
    Stefan Ram, Jun 4, 2014
  8. DFS

    James Kuyper Guest

    On 06/04/2014 06:44 PM, Stefan Ram wrote:
    They are unpredictable only due to a lack of sufficient information to
    make the prediction, not because of inherent unpredictability (except
    insofar as they serve as amplifiers for quantum mechanical randomness).
    It is only those sources which I would consider really random.
    I still don't understand why your brought this up. What does the
    distinction (or lack thereof) between classical and quantum sources of
    randomness have to do with the message that you were nominally
    responding to?

    I didn't use the term "real" to modify "source" or "number" or "random"
    or any related term. I only used "real" to modify "time" - referring to
    systems which have very hard, very important time constraints on the
    completion time for various tasks. It was completely irrelevant to my
    comment whether the process was used to generate those numbers involved
    classical physics, quantum physics, or a pseudo-random algorithm. The
    point was only whether or not the process had an upper bound on how long
    it would take.
    James Kuyper, Jun 5, 2014
  9. DFS

    Stefan Ram Guest

    Even in classical mechanics, physical states are probability
    measures on phase space, not points of the phase state¹.
    And then there is classical chaos! Which together gives ...

    (¹ See Section 1.3 and the rest in: A Course in Mathematical
    Physics; I Classical Dynamical Systems; Thirring, W.;
    Published by Springer-Verlag, 1991; ISBN 10: 0387536124 /
    ISBN 13: 9780387536125; or similar books such as Arnold)
    Stefan Ram, Jun 5, 2014
  10. DFS

    Stefan Ram Guest

    I was already responding to a question about my motives.

    |Those articles also don't seem particularly connected to your comments
    |in your first paragraph - were they intended to be?

    Answering another question of this meta-communicative type
    (why I »brought this up« with regard to »the message that« I
    was »nominally responding to«) about my response to the
    first one (»were they intended« to be »connected to« my
    »comments in« my »first paragraph«) is too labyrinthine for
    my limited brain. I am only able to write about C or physics
    in a more direct way.
    Stefan Ram, Jun 5, 2014
  11. DFS

    James Kuyper Guest

    It's been nearly three decades since I read the paper - if your memory
    is fresher than mine, you might be correct., however, uses "hidden
    variable" and "hidden parameter" quite prominently in many locations
    while describing the meaning of that paper.

    I should not have attempted to write that message from memory. I've
    never made any use of that information in several decades, so my memory
    of it is not that reliable. From the Wikipedia article it appears I've
    conflated the EPR paper in 1935 with Bell's paper "On the Einstein
    Podolsky Rosen paradox", nearly 30 years later. Well, they are closely
    related, and I did study both papers in great detail at about the same
    time, which would explain my confusion.
    James Kuyper, Jun 5, 2014
  12. DFS

    James Kuyper Guest

    Your messages may have been in response to that question, but they
    didn't seem particularly responsive. For example, the following is a
    simple "yes or no" question (though it invites a more detailed response):
    As far as I know, you've never answered that question clearly either
    "yes" or "no". That question was intended, if the answer was "yes", to
    invited a discussion about what the connection was, in your opinion. But
    your response didn't clearly explain that, either.
    It's not "another question", it's just a restatement of the original
    question, to which I've received no answer that I understand.
    I wasn't asking about the reasons for your responses to my questions
    about your first use of the phrase "real random numbers". I've only ever
    been curious about the reasons for your decision to discuss that topic
    in the first place. I can, if necessary, resign myself to the
    possibility that I'll never understand those reasons.
    James Kuyper, Jun 5, 2014
  13. (snip, someone wrote)
    At some point, coins and dice are also quantum systems, though
    at the macroscopic level. A photon has two polarization states
    (once you give a basis), and a coin has two different ground
    (that is, lying on the ground) states.

    You put either one in a superposition of states, such that
    (reference: Schroedinger's cat) when the wave function collapses
    it ends up on one of the two measurable states with equal

    A small difference in the ground state energy of the coin can
    bias the landing. Various details can bias the polarization state
    of photons.
    They all have a limit on how fast you can extract randomness.
    If you try too fast with a coin, it might not flip enough, and
    so be not random enough.

    If you try to extract photons too fast, the polarization might
    not be different enough.

    It might not be so obvious, but it takes energy to lose
    information. In this case, to lose the previous state of the
    system such that the new state is sufficiently random.
    There have been attempts to predict roulette. Blackjack is known
    to have less randomness under known conditions. But they are
    close enough for casinos to make a profit.

    -- glen
    glen herrmannsfeldt, Jun 5, 2014
  14. Physical quantum systems with a finite energy, ones useful for
    making random generators, tend to have a finite number of states.

    As well as I know it, time isn't quantized, but in the usual systems,
    position, momentum, and energy are quantized. At least by the time you
    get to a state where you can extract randomness, they have to be in
    one of a finite number of states.

    -- glen
    glen herrmannsfeldt, Jun 5, 2014
  15. (snip, someone wrote)
    How about for really really really large N?

    More specifically, how much randomness is there in the universe?

    Once you have extracted it all, then there isn't any more.
    (Though you should probably be outside the universe to extract it.)

    -- glen
    glen herrmannsfeldt, Jun 5, 2014
  16. (snip, someone wrote)
    There is an algorithm to take bits with non-uniform distribution
    and generate a (smaller) bit stream with uniform distribution.
    I forget the details, but some years ago intel build a hardware
    (noise source) random bit generator using it.

    Some described in:

    One that I didn't think of: exclusive OR a biased hardware random
    source with an unbiased PRNG.

    -- glen
    glen herrmannsfeldt, Jun 5, 2014
  17. DFS

    Stefan Ram Guest

    A free particle (in quantum theory) is a counterexample to
    this assertion.
    They can be or not: In the case of the hydrogen atom the
    spectrum has both a continuous and a discrete part, the
    continuous part representing the ionization.
    Stefan Ram, Jun 5, 2014
  18. But how free can it be? It is still inside the universe.

    The universe is large, so the levels will be close together,
    you might not be able to measure the levels, but that doesn't
    mean that they aren't there.
    -- glen
    glen herrmannsfeldt, Jun 5, 2014
  19. DFS

    Stefan Ram Guest

    Many assertions of physics are based on simplified models.
    In the case of a free particle, one often assumes the R³ as
    the universe. I have not yet seen calculations based on more
    realistic assumptions about the universe. It is possible
    that the spectrum then might become discrete, but for all
    practical purposes, a continuous spectrum is a good approximation.
    Stefan Ram, Jun 5, 2014
  20. DFS

    DFS Guest

    DFS, Jun 5, 2014
    1. Advertisements

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments (here). After that, you can post your question and our members will help you out.