locked
Random numbers RRS feed

  • Question

  • I need 20 numbers between 1 and 80 without and repeated numbers?
    Wednesday, July 28, 2010 11:58 PM

Answers

  • Put the 80 numbers in a list.  Get one randomly then remove it from the list.  Repeat until you have 20.  Something like this:

      Dim Rnd As New Random
      Dim Numbers As New List(Of Integer)
      Dim Number As Integer
      For count As Integer = 1 To 80
       Numbers.Add(count)
      Next
      For count As Integer = 1 To 20
       Number = Numbers(Rnd.Next(0, Numbers.Count))
       ListBox1.Items.Add(Number)
       Numbers.Remove(Number)
      Next
    
    
    • Proposed as answer by User_Help Friday, July 30, 2010 9:07 PM
    • Marked as answer by Liliane Teng Thursday, August 5, 2010 6:10 AM
    Thursday, July 29, 2010 12:16 AM

All replies

  • Put the 80 numbers in a list.  Get one randomly then remove it from the list.  Repeat until you have 20.  Something like this:

      Dim Rnd As New Random
      Dim Numbers As New List(Of Integer)
      Dim Number As Integer
      For count As Integer = 1 To 80
       Numbers.Add(count)
      Next
      For count As Integer = 1 To 20
       Number = Numbers(Rnd.Next(0, Numbers.Count))
       ListBox1.Items.Add(Number)
       Numbers.Remove(Number)
      Next
    
    
    • Proposed as answer by User_Help Friday, July 30, 2010 9:07 PM
    • Marked as answer by Liliane Teng Thursday, August 5, 2010 6:10 AM
    Thursday, July 29, 2010 12:16 AM
  • HiJustrc,

    It sounds like you're developing a Keno game.

    The following routine is what I usually use when wanting random numbers without repeating.

    I use a listbox as it gives me visual evidence during development.

    With the following code as an example you only need to add a listbox to a form.

    To use the numbers just read the first 20 numbers.

    Regards Ron.

    Private Sub Form1_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
        Dim myRnd As New Random(Now.Millisecond)
        Dim num, num1 As Integer
        'load listbox with numbers 1 to 80
        For i = 1 To 80
          ListBox1.Items.Add(i)
        Next
        'Shuffle numbers
        For i = 80 To 0 Step -1
          num = myRnd.Next(0, i)
          num1 = ListBox1.Items.Item(num)
          ListBox1.Items.RemoveAt(num)
          ListBox1.Items.Add(num1)
        Next i
      End Sub
    
    Thursday, July 29, 2010 5:07 AM
  • Dave no.

    The shuffle is good at producing unique numbers but not random numbers because true random numbers do repeat.

    Renee

    Thursday, July 29, 2010 5:20 AM
  • Hi Renee,

    I know you didn't address your remarks at me but I would just like to say that you have gone down this path before and all it did was to create an unending discussion.

    You're probably right, true random numbers do repeat but for all intents and purposes maybe we don't want random numbers we just want to get numbers at random. If everyone accepted the fact that we can't call our numbers random numbers but have to call them unique numbers then communication is going to become a lot more difficult.

    Our methods of shuffling allow for the fact that random numbers repeat. I at least have found that this is the best way of obtaining numbers at random without numbers repeating.

    If you want to draw 20 numbers out of 80 without getting the same number twice then this one way of doing it.

    Regards Ron

    Thursday, July 29, 2010 6:26 AM
  • Yes, I have gone down this path before. No, people don't listen to me. "Random numbers in large populations have charcteristics just like other numbers in large populations. Numbers obtained from a shuffle will not have the charcteristics of Random numbers.

    " maybe we don't want random numbers we just want to get numbers at random. "

    Then I have a couple of suggestions. Don't call them random numbers, call them shuffled numbers, then you'll be correct. You are not getting the numbers "at random" since they don't repeat. Drop the word Random and I wont have anything to say.

    Renee

    Thursday, July 29, 2010 9:51 AM
  • Numbers can be drawn from a population with or without replacement.  The numbers drawn from either population can be correctly refered to as "random numbers".
    Thursday, July 29, 2010 11:45 AM
  • Having numbers "with or without replacement" is not the issue. The issue is the properties of the numbers. Random numbers have duplicates every N numbers. These will not. Thefore they will not have the properties of populations of random numbers.

    Renee

    Thursday, July 29, 2010 11:58 AM
  • Again?  Renee - please show me the error in the following.  I can't find the code that prohibits the PRNG from producing duplicate values, matter of fact the debug statement does indeed show duplicates.  It looks like the same can be said for the other examples posted.  If you can't then please excuse yourself from the conversation unless you have something useful to contribute.

     

      Dim r As New Random
    
      Private Sub Button2_Click(ByVal sender As System.Object, _
                   ByVal e As System.EventArgs) Handles Button2.Click
        ListBox1.Items.Clear()
        ListBox1.Items.AddRange(Pick20)
      End Sub
    
      Private Function Pick20() As String()
        Dim tn As New List(Of Integer)
        Dim rv As New List(Of String)
        tn.AddRange(nums)
        Dim idx As Integer
        For x As Integer = 1 To 20
          idx = r.Next(0, tn.Count)
          'Debug.WriteLine(idx.ToString)
          rv.Add(tn(idx).ToString)
          tn.RemoveAt(idx)
        Next
        Return rv.ToArray
      End Function
    
      Dim nums As New List(Of Integer)
    
      Private Sub Form1_Shown(ByVal sender As Object, _
                  ByVal e As System.EventArgs) Handles Me.Shown
    
        Dim tn As New List(Of Integer)
        For x As Integer = 1 To 80
          tn.Add(x)
        Next
    
        Dim idx As Integer
        Do While tn.Count > 0
          idx = r.Next(0, tn.Count)
          nums.Add(tn(idx))
          tn.RemoveAt(idx)
        Loop
    
      End Sub
    
    

     

    Real simple.  You said "Random numbers have duplicates every N numbers.".  How is this code in violation of that.

     


    Subnet Calculator / Planner      Serial Port
    Thursday, July 29, 2010 2:50 PM
  • Yawn!!!!!!
    Thursday, July 29, 2010 2:57 PM
  • You said it Dave. I'll not excuse myself or explain it to others again.

    Renee

    Thursday, July 29, 2010 4:21 PM
  • Thursday, July 29, 2010 4:23 PM
  • No. You didn't think at all. You were deceptive about that. However, it appears yours does have the distribution i was looking for and my cursory examination suggests that you will have a random distribution.

    BUT the shuffler that was called for is missing? That was the piece that destroyed the random distribution. I doubt that I'll respond further to you since your responses are acrimonious and antagonistic.

    Renee

    Thursday, July 29, 2010 4:33 PM
  • Here's another method, depending on your version of VB:

     

    Dim rnd As New Random()
    Dim results = Enumerable.Range(1, 80).OrderBy(Function (i As Integer) rnd.Next()).Take(20)
    
    

    Thursday, July 29, 2010 5:13 PM
  • No. You didn't think at all. You were deceptive about that. However, it appears yours does have the distribution i was looking for and my cursory examination suggests that you will have a random distribution.

    BUT the shuffler that was called for is missing? That was the piece that destroyed the random distribution. I doubt that I'll respond further to you since your responses are acrimonious and antagonistic.

    Renee


    You are a bore, and arrogant.  No one appointed you the PRNG police.  You are the one that first mentioned shuffling, but don't let the facts get in your way. ("Dave no.  The shuffle is good at producing unique numbers but not random numbers because true random numbers do repeat. Renee"

    From what I can tell the code everyone provided produced what the OP wanted without prohibiting duplicate random numbers.  Every time someone posts a request for something resembling a lotto game, card dealer, etc. you make a big deal out of it.

    I am not impressed with you and anytime you want to compare resumes let me know.  But from other posts you have made I'll probably end up on the short end because you claim to have done everything.  My opinion is you are a joke.

    The guy you harangued about personal attacks against you was correct.  You are correct that when it comes to you I am both acrimonious and antagonistic.


    Subnet Calculator / Planner      Serial Port
    Thursday, July 29, 2010 6:35 PM
  •  

    Rene,

    a computer cannot generate a real random distribution it will always have a bias that comes from the function used to generate them.

    the average of computer generated number from 1 to 100 will never be 50 exactly..

    but picking shuffled number between 1 and 100 will statisticaly have an average of 50 and a normal distribution identical to the normal curve.

    So, it has a perfect reflect of a random distribution.

    The only difference is the the probability of picking twice the same number is zero instead then 1/n

    Still getting the probability of getting twice the same number to zero if often what is required by the algorithm

    Thursday, July 29, 2010 11:57 PM
  • Crazypennie,

    What's important in considering random numbet are 1.) Predictability and 2.) the distribution of the numbers that are output which can be broken down into various properties. From those criteria, a computer can put out a random number. Random numbers have a distribution and these will have a distribution that is similar. Random numbers have the properties of being generally unpredictable in the short run. These are generally not predictable.

    Take care,

    Renee

    Friday, July 30, 2010 2:13 AM
  • "You are a bore, and arrogant." (to the author of the statement.

    Add to that. I also have two PHDs, one in clinical and one in experimental psychology which means that I have doctoral level training in statistics. In case you have not noticed, these fora do not make appointments to the position of police but the fora do rely on people with expertise showing up. I do not care if you think that I am boring and arrogant. No one asked you. You volunteered a personal experience and one that was offered as if it's a characteristic of me as opposed to being one that involved with you also. I am not here to be entertaining or to please you in any way.

    Renee

    Friday, July 30, 2010 2:33 AM
  • I understand what you are trying to say Renee,

    if I pick a number out of 100 different one from a list, let say 60, this 60 is not a random number, it is a number picked randomly

    This process, has also a big difference with a random number, it is that if I chose to pick another number from the list, I know that it will not be 60, since there is no more 60 in that list.

    what I notice, is that you are talking about random number, and others are talking about random process

    Picking 20 different number out of 100 is a random process, the proof is that the average value of the number picked is 50

    but, out of this, only the first number picked is a random number since on all other pick, some number are missing and cannot be picked back

    Friday, July 30, 2010 2:34 AM
  • Yes, that's correct, Crazypennie. The subsequent numbers will not have the same distributions or characteristics as random numbers.

    Renee

    Friday, July 30, 2010 2:41 AM
  • Since you are so adept at picking nits it is shocking how you use random so freely in this context.  Windows does not have a RNG, it is a PRNG. 

    What useful contribution did you make to this thread?  You pointing out the failings, especially when there weren't any, of code others provided does not pass muster for being helpful.  The regular posters here now how the PRNG provided by windows works.

    Subnet Calculator / Planner      Serial Port
    Friday, July 30, 2010 12:41 PM
  • You know what? You are the only one who is keeping a threshold, which is your own by the way, on "passibg muster". It's old and it's boring anf inaccurate to boot.

    In short, I don't take you seriously.

    Renee

    Friday, July 30, 2010 1:19 PM
  • The invitation to point out the actual "error" made in the code I, or one of the others, posted is still open.  So yack away.
    Subnet Calculator / Planner      Serial Port
    Friday, July 30, 2010 4:14 PM
  • That's easy enough. By mutual exclusion found primariliy in a shuffler the problem traditionally has been  not knowing the properties of a random distribution of numbers and attending to them. It has been a problem of approach and conceptualizing what random numbers and a random distribution, is.

    Renee

    Friday, July 30, 2010 8:49 PM
  • "Get one randomly then remove it from the list. "

    No Dave. That's exactly what NOT to do.

    Renee

    Friday, July 30, 2010 9:13 PM
  • Hi Renee,

    My major interests in VB are game type programs which use "random" numbers (I use the term loosely), and I was interested in your statement to Dave;

    "No Dave. That's exactly what NOT to do."

    If that is what not to do then what should one do?

    Can you give us a sample of some code?

    Ron

    Friday, July 30, 2010 10:43 PM
  • It is real simple, copy and post the code in error, along with your diagnosis Dr. Ruth.

    Subnet Calculator / Planner      Serial Port
    Friday, July 30, 2010 10:45 PM
  • I have been quietly watching this thread and *shakes head* it reminds me of a time I once asked a mathematician about random numbers. In fact it was worse than that it was a random large prime I was looking to generate for some encryption stuff. After about a three hour lecture on all sorts of topics from probability to chaos theory to calculus I was told the only way to produce what I needed was to record background radiation from outer space, the sound of the universe, and derive a selection of samples using Blaschke selection theorem that converged with K in a Hausdorff metric.

    That was about 2 years ago.... I'm still trying to build the space ship.


    Will code for money.
    Friday, July 30, 2010 11:19 PM
  • You can actually have it without the space ship

    http://www.random.org/


    Subnet Calculator / Planner      Serial Port
    Friday, July 30, 2010 11:24 PM
  • Derek,

    Part of my issue is that people have been using lay terms form the word random.

    Dbassinett, I shall not write any code for you. A routine which produces numbers randomly deserves some attention the kind I do not intend to spend at this time.

    My task is to let people know that this forum has been using the word random incorrectly. I should like to remind you that I am not on call by you and do not do work for you and that you show undue hostility. Derek there really is nothing abstruse in my messages. I do know that as frustrating as I may find mathematicians, the frustration is mine.

    Renee

    Saturday, July 31, 2010 5:16 AM
  • Hi Renee, I don't have any issues with your replies. The situation with the mathematician was just to emphasize that hours, and it was hours, of irrelevant discussion lead not to some wonderful enlightenment of the beauty of mathematics, or to a random large prime, but to some impractical advice on taking a microphone into space. Technically it was the correct answer, technically it was the best answer, but giving the situation and reasons for wanting the random large prime it was just a lot of hot air because none of it helped me reach my goal. I had to build a space ship first.

    Renee what I am saying is just be careful your not telling everyone to build a space ship if you get what I mean.

    I must admit that I am curious and interested like Ron is in his post as to why Daves suggestion was wrong and on how else it could be done. 

     

     


    Will code for money.
    Saturday, July 31, 2010 10:35 AM
  • I'm sorry, Derek. Dave is usually correct. In this case, preventing the reoccurane of a number means that the distribution is no longer random since the practice induces a change away from the characterics of random numbers.

    Something else has just occurred to me. THIS is not "adding nothing". Actually I am adding a lot by teaching the forum about random numbers.

    Renee

    Saturday, July 31, 2010 10:43 AM
  • "Get one randomly then remove it from the list. "

    No Dave. That's exactly what NOT to do.

    Renee


    Renee,

    This exacly what to do

    If I ask you to pick a card, and you pick let say the 8 of clubs, and then I ask you to pick anotherone, Your probability to pick the 8 of clubs are are null since it it not in the stack anymore.

    the process of programaticaly picking number randomly should mimic what happen when we physicaly do the process

    when you pick the first card, the probability of picking any singled card is 1/52

    when you are picking the second one, they are 1/51 for all the cards not picked and 0 for the card that was already picked

     

    this process of removing the card from the list does mimic this perfectly in all it's properties

    So, this is what to do

     

    Saturday, July 31, 2010 11:14 AM
  • Crazypennie,

    Thats not what random is. Drawing randomly (from a random distribution), the chaces of coming up with any card are equiprobable not nill or null. Yes, a card draw as long as card is reinseted is random. However, removing the card destroys randomness by destroying the characteristic of equiprobablity.

    Renee

    Saturday, July 31, 2010 11:23 AM
  • Who are you talking to Mr. Hostile?

    Renee

    Saturday, July 31, 2010 11:28 AM
  • this is not random is, you are right,

    but this is what the process of picking number randomly is without picking a number twice is,

    each time you pick a number, it will change the probability of picking the following one.

    It would make no sens to keep having some chance to pick the 8 of clubs once it has been removed.

     

    Saturday, July 31, 2010 11:33 AM
  • what has to be random, is only the order where they were picked, not the values  of the number picked
    Saturday, July 31, 2010 11:36 AM
  • You too are correct. But the op did not say "draw randomly". The op entitled the thread, "Random Number" but immediately described a sequence that was not random.

    "It would make no sens to keep having some chance to pick the 8 of clubs once it has been removed.

    Well then, it's not random. See the problem here with nomenclature?

    Renee

    Saturday, July 31, 2010 11:43 AM
  • Yes, but he also say without "repeating number", so I have to understand that in fact he does not want random numbers, but some numbers picked randomly.

    I will agree with you, that this is not the same thing, but, and you know it since you are on this forum since longer than I am,

     We need to learn to read in between the lines to understand the OP's question

    Saturday, July 31, 2010 11:51 AM
  • Derek,

    Part of my issue is that people have been using lay terms form the word random.

    Dbassinett, I shall not write any code for you. A routine which produces numbers randomly deserves some attention the kind I do not intend to spend at this time.

    My task is to let people know that this forum has been using the word random incorrectly. I should like to remind you that I am not on call by you and do not do work for you and that you show undue hostility. Derek there really is nothing abstruse in my messages. I do know that as frustrating as I may find mathematicians, the frustration is mine.

    Renee


    I did not ask you to write code, did I.  But it is a shame that someone as great as you are could not show us how this should be done so that in the future we wouldn't be subject to your ranting.

    I looked through your contributions to this thread and can honestly say I didn't find any new information, just confirmation of what I continue to think of you.


    Subnet Calculator / Planner      Serial Port
    Saturday, July 31, 2010 11:56 AM
  • Crazypennie,

    I need to disagree with you that, "We need to learn to read in between the lines to understand the OP's question". That's my whole point. Random has a meaning and the op is busy contadicting himself.

    Renee

    Saturday, July 31, 2010 12:00 PM
  • Renee - Really?  Between the Subject and the words in the first post there was some doubt about the intent?  Have you considered running for elected office?  The ability to turn the simple into the complicated, long winded, obtuse is welcomed there.

    Subnet Calculator / Planner      Serial Port
    Saturday, July 31, 2010 12:06 PM
  • "I did not ask you to write code, did I.  But it is a shame that someone as great as you are could not show us how this should be done so that in the future we wouldn't be subject to your ranting."

    I am in the process of recovering from being a pedestrian being struck by an illegal alien. I am busy relearning basic. You do not assign tasks to me.

    "I looked through your contributions to this thread and can honestly say I didn't find any new information, just confirmation of what I continue to think of you."

    I do not care what you think of me.

    "Really?  Between the Subject and the words in the first post there was some doubt about the intent?  Have you considered running for elected office?  The ability to turn the simple into the complicated, long winded, obtuse is welcomed there."

    I don't believe I made any commments to you. You have chosen to pick me out under false pretenses. You are not interested in my running for office. You are engaging me with hostile intent. Stop it.

    Renee

    Saturday, July 31, 2010 12:08 PM
  • No. The sample MUST be random in order to get a random result.

    Renee

    Saturday, July 31, 2010 12:21 PM
  •  

    Have a good day every one, don't fight too mush, it is not good for the moral

    See ya in another thread

    Saturday, July 31, 2010 12:23 PM
  • Actually, I really sorry to see you leave.

    Renee

    Saturday, July 31, 2010 12:26 PM
  • I didn't ask you on whether I should run for office. That's your stuff.

    Renee

    Saturday, July 31, 2010 12:31 PM
  • There are many random processes which can be described by a probability density function.  The uniform distribution is one such function.  To exclude all processes which can't be described by the uniform distribution from one's thinking is ludicrous.  The Normal distribution and the Central Limit theorem are much more important than the uniform distribution.
    Saturday, July 31, 2010 2:10 PM
  • For about the fifthieth time, I have not been talking about processes at all. I have been talking about distributions of random numbers and related random distributions.

    We have been discussing random numbers and random distribution AND distributions the people have been erroneously calling "random".

    Renee

    Saturday, July 31, 2010 2:18 PM
  • "I did not ask you to write code, did I.  But it is a shame that someone as great as you are could not show us how this should be done so that in the future we wouldn't be subject to your ranting."

    I am in the process of recovering from being a pedestrian being struck by an illegal alien. I am busy relearning basic. You do not assign tasks to me.

    "I looked through your contributions to this thread and can honestly say I didn't find any new information, just confirmation of what I continue to think of you."

    I do not care what you think of me.

    "Really?  Between the Subject and the words in the first post there was some doubt about the intent?  Have you considered running for elected office?  The ability to turn the simple into the complicated, long winded, obtuse is welcomed there."

    I don't believe I made any commments to you. You have chosen to pick me out under false pretenses. You are not interested in my running for office. You are engaging me with hostile intent. Stop it.

    Renee


    Almost since I joined you have been recovering from this accident.  Funny thing, you only trot it out when cornered.  In case you haven't noticed this is an anonymous forum, so any claims made by anyone, including myself, need to be viewed under the skeptics microscope. 

    When it suits you, you can write code.  If you have forgotten I can post some recent links where you seem to have a firm grasp of VB .Net.

    You started this, again .  If I had only seen the first two posts in this thread I would have just gone on, but there you were on the bully pulpit again.

     


    Subnet Calculator / Planner       Serial Port
    Saturday, July 31, 2010 2:19 PM
  • I can write code and I have not said that I did not. I said that I chose to follow a routine set by me and not by you.

    The idea that 'claims need to be examined under a microscope" is ludicrous and false. It's indicative of a boundary problem that you have but that's obvious. I pay no attention to claims made here although I do have good boudaries and know aspects of 'where I stop' and 'where you begin'. Part of those boundaries include doing what I choose and not doing what you choose. Another part of my boundaries include the treatment of the BS you put out as exactly that. It's BS and I shall treat it as such.

    An example of your BS is that of me being on the 'bully pulpit.' You can't deliver the first quote where I wasn't addressing the error in random numbers and in random distributions simply because I was not on the bully pulpit.

    Renee

    Saturday, July 31, 2010 2:39 PM
  • We have been discussing
    You never discuss anything.
    Saturday, July 31, 2010 2:39 PM
  • 'You never discuss anything."

    Not with you I don't, John. I find you antagonistic. I do discuss things with Derek and I have done so in this thread. So that makes you wrong again. I discuss things with people I respect. Derek is into C also. I have also discussed this thread with Crazypennie in this thread.

    It's just that his approach is friendly and yours as I have shown in this post is antagonistic as well as incorrect.

    Renee

    Saturday, July 31, 2010 3:01 PM
  • "Almost since I joined you have been recovering from this accident.  Funny thing, you only trot it out when cornered."

    That's true because I don't want to discuss it with you.

    Did that ever occur to you Mr. righteous? You all are the only ones who get personal with me Mr Righteous.

    Renee

    Saturday, July 31, 2010 6:00 PM
  • You missed the point, which seems to be something you do on a regular basis.  Why bring up your accident?  How is it relevant to a discussion about random? And believe me, I don't want to discuss your "accident".

    You said "I am in the process of recovering from being a pedestrian being struck by an illegal alien. I am busy relearning basic." followed by "I can write code and I have not said that I did not". So which is it?

    The OP's thread started like this:

    Subject: Random numbers

    Body: I need 20 numbers between 1 and 80 without and repeated numbers?

    Shortly after that you posted "Yes, I have gone down this path before. No, people don't listen to me. "Random numbers in large populations have charcteristics just like other numbers in large populations. Numbers obtained from a shuffle will not have the charcteristics of Random numbers.

    " maybe we don't want random numbers we just want to get numbers at random. "

    Then I have a couple of suggestions. Don't call them random numbers, call them shuffled numbers, then you'll be correct. You are not getting the numbers "at random" since they don't repeat. Drop the word Random and I wont have anything to say."

     

    Back to Renee at jibber-jabber central...

     

     

     

     


    Subnet Calculator / Planner       Serial Port
    Saturday, July 31, 2010 7:03 PM
  • And Renee, don't forget to threaten me with turning me in to the forum abuse police.

    Subnet Calculator / Planner      Serial Port
    Saturday, July 31, 2010 7:12 PM
  • Quote: Random has a meaning

    This is the cause of subsequent difficulties. Random has more than one meaning, as do most words. The meaning of any word is bound up with the context in which it is used. E.g. "The compositor became annoyed when a line of letters slid off his random". Now there's a perfectly good use of random (albeit rather rare) that has nothing to do with random in this thread. In the posts that suggested solutions, given the context, the use seems to be in the everyday sense of "without conscious choice" rather than one of the more formal definitions. And that's perfectly acceptable.

    I think the posts were not using the word in it's strict mathematical/statistical sense but in it's everyday sense. Even in mathematics/statistics there is debate about how to define random. There's an a priori definition based on equal probabilities (but it turns out to be circular); there's a definition relying on observed frequencies (but it assumes an infinite number of trials). There's also a definition to the effect that a sequence of numbers is random if you cannot generate the sequence by writing a computer program that is shorter than the sequence.

    All very interesting, philosophically, but it does not get the problem solved. And that has been done with sample code.

    BTW The OP asked "I need 20 numbers between 1 and 80 without and repeated numbers?". There is no mention of the word random, so there is no possibility of a contradictory use of the word by the OP.



    Regards David R --------------------------------------------------------------- "Every program eventually becomes rococo, and then rubble." - Alan Perlis The only valid measurement of code quality: WTFs/minute.
    Sunday, August 1, 2010 7:54 AM
  • Why are you talking to me? It seems you are adding extranous material to each thread.

    Renee

    Sunday, August 1, 2010 8:07 AM
  • It seems you are adding extranous material to each thread.

    You certainly are.  But then you always have. 
    Sunday, August 1, 2010 9:12 AM
  • Which is why I say you are hostile. My material is not extraneous and you will find it impossible to make a case for that but you don't mind making untrue claims.

    You came into this thread to post that attack? You are the one who makes extraneous posts in the form of attacks and you have no support for your claims at all.

    Renee

    Sunday, August 1, 2010 9:51 AM
  •  

    'I think the posts were not using the word in it's strict mathematical/statistical sense but in it's everyday sense"

    The authors do not know that there is a difference. There is and as far as mathematics is concerned there are many lay terms that are used that are incorrect as well as contradictoy.

    "There is no mention of the word random, so there is no possibility of a contradictory use of the word by the OP."

    You might take a look at the name of this thread.

    Renee

    Sunday, August 1, 2010 10:49 AM

  •  

    'I think the posts were not using the word in it's strict mathematical/statistical sense but in it's everyday sense"

    The authors do not know that there is a difference. There is and as far as mathematics is concerned there are many lay terms that are used that are incorrect as well as contradictoy.

    "There is no mention of the word random, so there is no possibility of a contradictory use of the word by the OP."

    You might take a look at the name of this thread.

    Renee


    Being one of the authors of a possible solution I take it that you are making yet another personal attack on me.  You seem to be one of those people that feel intelligent only when they are pointing out a supposed ignorance in others.  You continually use the word random in the context of this thread, when in fact you should be using the term pseudo-random numbers.  Once more I invite you to put an end to this debate by providing a solution that satisfies whatever point you are making and answers the OP. 
    Subnet Calculator / Planner      Serial Port
    Sunday, August 1, 2010 11:42 AM
  • " Once more I invite you to put an end to this debate by providing a solution that satisfies whatever point you are making and answers the OP.  "

    This debate is one of basal education, not of code. I have said no, I intend to provide no solution. Yet you continue to ask, when there is no reason to. How much clearer need I be in saying I have no desire to solve your problems?

    "Being one of the authors of a possible solution I take it that you are making yet another personal attack on me."

    I did not say or imply you in any fashion. I do not consider you part of the solution at all so I was not talking to you in your wildest, most paranoid flights of imagination.

    Please get help.

    Renee

    Sunday, August 1, 2010 11:56 AM
  • Lady, For f.... sake, what is your problem?

    You seem to spend your entire life stalking these help forums just being abusive, insulting, offensive and plain unpleasant to everyone for no other reason than that is who you are.

    Don’t you understand, you’re unwelcome. You are a fundamentally unpleasant person with no apparent likeable qualities; you spit snarl and drip your venom everywhere and that appears to be your only "talent".

    You're the one who needs the mental help, you should be locked up and the key thrown away.

    Do everyone a favour and crawl back into the gutter where you belong AND STAY THERE.


    Steve
    Sunday, August 1, 2010 12:17 PM
  • I maybe unwelcome to you, on the other hand you are incorrect and are having difficulty dealing with that. If you can find one thing I have originated that's attacking, let's see it.

    Since when do these fora have a welcome or unwelcome sign? That seems like a problem had by you, not me because these fora do not have admissions.

    I don't have any venom. It's just that you and the rest of the people here don't know very much of the properties of random. Are you afraid of learning something or staying ignorant? Find the first erroneos thing that I've said about random or these distributions.

    Renee

    Sunday, August 1, 2010 12:42 PM
  • No one posted anything that broke any rule or definition of pseudo-random numbers, did they.  You, in your arrogance, are the only one that drew an inaccurate conclusion based on the OP's subject line connected to the OP's question. 

    Here is what we all(minus one) think the OP meant:

    I want to emulate an 80 ball lottery machine.  To do this I want to remove twenty balls pseudo-randomly from the hopper. 

    Two perfectly acceptable solutions were provided before you felt the need to "educate" us.

    Your education started with this: "The shuffle is good at producing unique numbers but not random numbers because true random numbers do repeat."

    Lets scrutinize you:

    1.  There is not a native TRNG in .Net.  You could have pointed that out but chose to omit that fact.  Do you understand the difference between TRNG and PRNG?

    2.  " true random numbers do repeat" - Ol' stupid me thought "a random number is one that is drawn from a set of possible values, each of which is equally probable."  Did you mean to point out that what you said is only true based on a finite set of static numbers?  If the set is infinitely large then the probability of any number selected is 1/infinity.  I am sure you know what that does to your "fact".  You should have said that if you have a finite set of static numbers, N, and you make N+1 draws randomly, a number will repeat.

    Let me say this to you again.  If you are going to be personally insulting (that is where you use a persons name and insult together) you should have the common courtesy of being correct.

    e.g.

    Dave no.

    The shuffle is good at producing unique numbers but not random numbers because true random numbers do repeat.

    Renee

    could have been written as

    The shuffle is good at producing unique numbers but not random numbers because true random numbers do repeat.

    Renee



    Subnet Calculator / Planner       Serial Port
    Sunday, August 1, 2010 1:00 PM
  • "or definition of pseudo-random numbers, did they.  You, in your arrogance, are the only one that drew an inaccurate conclusion based on the OP's subject line connected to the OP's question."

    I am arrogant and have never question that. There is no definition of pseudorandom numbers. I did not draw an in accurate conclusion. If the OP called has thread 'Random Numbers" assuming the OP can write then the thread becomes about random numbers. Certainly that's what the thread is about or is reading another difficulty you have?

    Don't you think you need a lot of education before attempting to review my posts in something beyond incomplete sentences?

    "Dave no.

    The shuffle is good at producing unique numbers but not random numbers because true random numbers do repeat.

    Renee"

    This is correct and attacks Dave in no way.

    And

    "could have been written as"

    Where do you get off telling me how to write? You have huge boundary problems. I'm over here...you are over there. I'm the author of what I write and you are not.

    Renee

    Renee

    Sunday, August 1, 2010 1:11 PM
  • "or definition of pseudo-random numbers, did they.  You, in your arrogance, are the only one that drew an inaccurate conclusion based on the OP's subject line connected to the OP's question."

    I am arrogant and have never question that. There is no definition of pseudorandom numbers. I did not draw an in accurate conclusion. If the OP called has thread  'Random Numbers" assuming the OP can write then the thread becomes about random numbers. Certainly that's what the thread is about or is reading another difficulty you have?

    Renee


    How are those feet tasting? 

    Pseudo-random definition: " PRNGs are algorithms that use mathematical formulae or simply pre-calculated tables to produce sequences of numbers that appear random." from random.org

    "Pseudo-random numbers are chosen with equal probability from a finite set of numbers. The chosen numbers are not completely random because a definite mathematical algorithm is used to select them, but they are sufficiently random for practical purposes. The current implementation of the Random class is based on Donald E. Knuth's subtractive random number generator algorithm. For more information, see D. E. Knuth. "The Art of Computer Programming, volume 2: Seminumerical Algorithms". Addison-Wesley, Reading, MA, second edition, 1981." from MSDN documentation for the Random class.


    Subnet Calculator / Planner      Serial Port
    Sunday, August 1, 2010 1:21 PM
  • Lady, For f.... sake, what is your problem?

    You seem to spend your entire life stalking these help forums just being abusive, insulting, offensive and plain unpleasant to everyone for no other reason than that is who you are.

    Don’t you understand, you’re unwelcome. You are a fundamentally unpleasant person with no apparent likeable qualities; you spit snarl and drip your venom everywhere and that appears to be your only "talent".

    You're the one who needs the mental help, you should be locked up and the key thrown away.

    Do everyone a favour and crawl back into the gutter where you belong AND STAY THERE.


    Steve

    If the only attention a person gets is bad, it is preferable to no attention.

    Subnet Calculator / Planner      Serial Port
    Sunday, August 1, 2010 1:26 PM
  • "or definition of pseudo-random numbers, did they.  You, in your arrogance, are the only one that drew an inaccurate conclusion based on the OP's subject line connected to the OP's question."

    I am arrogant and have never question that. There is no definition of pseudorandom numbers. I did not draw an in accurate conclusion. If the OP called has thread  'Random Numbers" assuming the OP can write then the thread becomes about random numbers. Certainly that's what the thread is about or is reading another difficulty you have?

    Don't you think you need a lot of education before attempting to review my posts in something beyond incomplete sentences?

    "Dave no.

    The shuffle is good at producing unique numbers but not random numbers because true random numbers do repeat.

    Renee"

    This is correct and attacks Dave in no way.

    And

    "could have been written as"

    Where do you get off telling me how to write? You have huge boundary problems. I'm over here...you are over there. I'm the author of what I write and you are not.

    Renee

     

    Renee


    Could have is not should have.  I see you are into editing your posts again.  Every time you avoid questions / challenges you just dig a deeper hole. 

    I get off telling you how to write from the same place you get off telling people how stupid we are compared to your superior intellect.


    Subnet Calculator / Planner       Serial Port
    Sunday, August 1, 2010 1:38 PM
  • I understand what a pseudo-random table is. Do you? That's not to say that I knew what your definition of your abbreviation was.

    You are still talking to me. I've said over and over again that, "I do not wish to talk to you or care what you say."

    Goodbye Abusive person.

    Renee

    Sunday, August 1, 2010 1:44 PM
  • Speak for yourself. Your obviously can not speak for me.

    Renee

    Sunday, August 1, 2010 1:49 PM
  • Hey people calm down. Just asked a simple question I thought. Didn't mean to start sush a heated discusion about random numbers! The solution that was given to me served the purpose.
    Sunday, August 1, 2010 2:12 PM
  • "or definition of pseudo-random numbers, did they.  You, in your arrogance, are the only one that drew an inaccurate conclusion based on the OP's subject line connected to the OP's question."

    I am arrogant and have never question that. There is no definition of pseudorandom numbers. I did not draw an in accurate conclusion. If the OP called has thread  'Random Numbers" assuming the OP can write then the thread becomes about random numbers. Certainly that's what the thread is about or is reading another difficulty you have?

    Don't you think you need a lot of education before attempting to review my posts in something beyond incomplete sentences?

    "Dave no.

    The shuffle is good at producing unique numbers but not random numbers because true random numbers do repeat.

    Renee"

    This is correct and attacks Dave in no way.

    And

    "could have been written as"

    Where do you get off telling me how to write? You have huge boundary problems. I'm over here...you are over there. I'm the author of what I write and you are not.

    Renee

     

    Renee


    For someone demanding preciseness you are a failure at it. "There is no definition of pseudorandom numbers."  For someone that doesn't want to be told what to do, you are good at it.  I'll speak if I choose to speak. 

    Subnet Calculator / Planner      Serial Port
    Sunday, August 1, 2010 2:17 PM
  • Lobotomy Head,

    You haven’t offered any helpful advice for several years. All your posts seem to be smart-____ comments “quite agree”, “that’s stupid”, this is a silly question”, “yes, that is good code” etc etc etc etc etc etc etc. ya de ya de ya de ya de ya but you never actually write anything useful to help us lessers.

    The sad thing is: when I first started in this forum I used to look forward to reading your advice because it was good. To use your own words “I offer 80% of the answer and let them find the other 20%”.

    Yes, your own words. I remember them from 3 years ago and you inspired me to find answers that I had given up finding; you gently prodded people into going in the right direction

    Nowadays? You’re a sneering, loathsome, asinine, obnoxious mouth-flatulent idiot.

    You’re a joke.


    Steve
    Sunday, August 1, 2010 3:33 PM
  • Steve,

    How do you know that I've sneered? How do you know that I am " loathsome, asinine, obnoxious mouth-flatulent idiot."

    The answer is you know none of the above and are there fore abusive.

     

    Tata for now

    Renee

     

    Sunday, August 1, 2010 4:10 PM
  • When the moderators look at those you report I wonder if they look at just that post or everything leading up to it.  You may be more subtle in your abuse, but you, none-the-less, are abusive.  "It's just that you and the rest of the people here don't know very much of the properties of random."  Where I come from you just called everyone stupid.

    You are fortunate Renee.  If this was one of those silly "reality" shows you would have been voted off the island a long time ago.  I hereby dub thee JJQoR.

    I am glad to see the OP got the correct answer.


    Subnet Calculator / Planner      Serial Port
    Sunday, August 1, 2010 4:41 PM
  • Hey people calm down. Just asked a simple question I thought. Didn't mean to start sush a heated discusion about random numbers! The solution that was given to me served the purpose.


    None of this was aimed at you, and you did not start this. If you need or want a clearer understanding of random I would suggest that you read http://www.random.org/randomness/ or http://msdn.microsoft.com/en-us/library/system.random.aspx .  It is my humble opinion that every programmer should have volumes 1-3 of "The Art of Computer Programming" by Dr. Knuth.

    JJQoR has brought this on herself over the years.  Hopefully you will find these forums useful and will be glad to know that most people here do not act as she does.


    Subnet Calculator / Planner       Serial Port
    Sunday, August 1, 2010 4:50 PM
  • Youre still addressing me.

    You are full of it. I have been subjected to false standards set up by you surprise, surprise.

    I'm happy to be voted off the island any time. In case you haven't noticed it's a popular tv show. You see, that's what I've been trying to say. I don't care for popular Americana at all, so I'd be happu to be voted off.

    You seem to have a more difficult time with staying on subject and actually addresssing issues. BUT what the heck, you told enough lies to sink a ship. Why bother?

    Renee

    Sunday, August 1, 2010 4:57 PM
  • Youre still addressing me.

    You are full of it. I have been subjected to false standards set up by you surprise, surprise.

    I'm happy to be voted off the island any time. In case you haven't noticed it's a popular tv show. You see, that's what I've been trying to say. I don't care for popular Americana at all, so I'd be happu to be voted off.

    You seem to have a more difficult time with staying on subject and actually addresssing issues. BUT what the heck, you told enough lies to sink a ship. Why bother?

    Renee


    Some more abuse(now I am a liar)?  What lies?  Please be specific.  Or is it just more JJ?

    Subnet Calculator / Planner       Serial Port
    Sunday, August 1, 2010 5:13 PM
  • HI all,

      dbasnett I have to agree with Renee about random numbers, There is no such thing as a (random number on a computer). This at our present computing capability is impossible because there has to be a seed used to compute the so called random number and this seed is the system clock witch in itself is repeating and there by causing the seed to be repeated. In the real world true random numbers is generated by Chaos. This is because Chaos is not ordered in any way.

     I use chaos as an example because no one realy knows how random works in the real world. Chaos is believed to be what existed before the ordered universe and Chaos still exists because of the random events that happen without a true cause.

     I have experimented with random numbers in looking for a closer to real world random and what i have found out is this, you can use a history of numbers generated for each set to make sure there is no repeats of numbers for what ever number of history strings you have. But even when this appears to give you a true random number it does not because it will give a repeat after that history string is no longer checked because of the new history string that was just added and the oldest one has been removed.

     A computer is a structured, ordered enviroment and this is the reason it can never generate as the real world random does. If we ever get to the point of using Quantum theroy in computing we may come closer to understanding the real world random numbers and be able to generate a closer to true random number.

    Curtis


    Always Lost in Code, Always mark answers as correct if they answer you question and solve your problem. This way others when searching for similar problems can find the answer faster.
    Monday, August 2, 2010 3:16 PM
  • I went back and re-read this whole disgusting thread.  Renee was never making a distinction between TRNG and PRNG.  If you bothered to read this thread you might have assumed that I do understand the difference between the two.  Of course you might believe that I posted the links I did without comprehending what they said.  You might also think that I do not have a well worn set of Dr. Knuth's works.

     

    I might believe that you often defend Renee.  My issue, and I think others, is not with her knowledge, but with her attitude.  I certainly know that I am not the smartest person posting here, and neither is Renee, but unless you treat her as if she is then she is unbearable.


    Subnet Calculator / Planner      Serial Port
    Monday, August 2, 2010 5:02 PM
  • "Renee was never making a distinction between TRNG and PRNG."

    That's true. Thats true because it's not relelevant to the argument am I making. I say that random is a known phenomenon. I also say that computer people frequently misuse the word "random". Randow had a known rectacular distributiom and will repeat 1/n times. Probalistically it has a mean of .5 times it's maximum number. I am saying that computer people should know the meanings of the words they use and they do not know what random means, That's all I have been saying. You see that I have said nothing about a TRNG and a PRNG because thet are not germane to my argument aat all. I have not been discussing computer generated numbers, other to say that I think muvh care is needed in proposing yes, proposind random algorith.

    By they way. "I am not here to please you" includes that I don't care in the least whether Dbanett thinks that I am insufferable ot not.

    Renee

    Monday, August 2, 2010 7:41 PM
  • dbasnett,

      I did not mis read the thread and It is what Renee was refering to. There is only one distinction for the rnd and the only difference is in the way the rnd programmed. All the technics used in programming have the same outcome and that is it repeats. 

      Yes I do defend Renee and this because most on this forum does not try to understand her methods of communication. You say you don't like her attitude and other people have a problem with it. Well they need to take a closer look at thier own attitudes. She is not the only person on this forum that has an abrupt attitude. If you had been misqouted and mis treated by certain people like she has been then I suspect you would have the same attitude and if you say no I wouldn't then you would be lieing. 

      I don't like the way that the forum has changed from what it used to be. You used to get help when you asked a question and Renee helped me a lot with answers no one else wanted to answer because of this or that reason.

      So if this remark about me defending is supposed to make me feel ashamed I am not and anyone who wants to down me for defending her, is a person that I want no association with because they have no compasion or feelings for other people. Renee has feelings for other people witch is more than I can say for some people on this forum.

     

    Curtis


    Always Lost in Code, Always mark answers as correct if they answer you question and solve your problem. This way others when searching for similar problems can find the answer faster.
    Monday, August 2, 2010 8:57 PM
  • Ron,

    It's not that you are doing the wrong thing, you are calling the numbers the wrong thing. These numbers, given that the number cannot reoccur, are not random numbers.

    Renee

    Thursday, August 5, 2010 10:15 AM
  • "It would make no sens to keep having some chance to pick the 8 of clubs once it has been removed."

    But, changing the defintion of random numbers, does not make sense. if the change is made to fit the task. Rather the descriptor of what you are doing should change to match what you are doing.

    Renee

    Thursday, August 5, 2010 10:28 AM
    1. For this experiment you will need a brown cardboard box(12" x 12" x 12") and a deck of 52 playing cards.
    2. Take the cards from the pack and dump them into the cardboard box.  Seal the box and cut a hole in the box large enough for your hand.
    3. Shake the box vigorously for a minute.
    4. Place the box on a table so that you can stick your hand in the box, but can not see inside the box.
    5. Place your hand in the box and RANDOMLY remove a card.
    6. Burn that card.
    7. Repeat steps 5 and 6.  I promise that the odds you will RANDOMLY remove the same card at Step 5 will be 0%

     

    If you change step 6 to be "Return the card to the box" then the odds that your random selection will return a duplicate card go from 0% to 1.92%.


    Subnet Calculator / Planner      Serial Port
    Thursday, August 5, 2010 2:01 PM
  •   'Random numbers MIGHT repeat.
      'The PROBABILITY of repeating is 1/N where N is the set of numbers.
      'As N approaches infinity the probability approaches zero.
    
      'If you toss a coin 100 times it might come up tails every time.
      '"In mathematics, there must be an infinite expansion of information for randomness to exist."
    
      Dim aPRNG As New Random
      Dim theNumbers As List(Of Long)
      Dim aLock As New Object
      Dim repeat As Long
      Dim found As Long
    
      Private Sub Button2_Click(ByVal sender As System.Object, _
                   ByVal e As System.EventArgs) Handles Button2.Click
    
        Debug.WriteLine("Start repeating random numbers check @ " & DateTime.Now.ToShortTimeString)
        found = 0L
        theNumbers = New List(Of Long)
        Dim t1 As New Threading.Thread(AddressOf doRNG)
        Dim t2 As New Threading.Thread(AddressOf doRNG) 'comment out for single core systems
        t1.Start()
        t2.Start() 'comment out for single core systems
        Do
          Threading.Thread.Sleep(1000)
        Loop While Threading.Interlocked.Read(found) = 0L
        'show end time and how many numbers were generated before repeat
        Debug.WriteLine("A random number repeated @ " & DateTime.Now.ToShortTimeString)
        Debug.WriteLine(theNumbers.Count.ToString)
        Debug.WriteLine(repeat.ToString)
      End Sub
    
      Const maxV As Integer = Integer.MaxValue
      'Const maxV As Integer = 6
    
      Private Sub doRNG()
        Dim i As Integer, l As Long
        Threading.Thread.Sleep(0)
        Do
          'create a large PRN
          i = aPRNG.Next(maxV)
          l = CLng(i) << 32
          l = l Or aPRNG.Next(maxV)
          'did the PRN repeat
          Threading.Monitor.Enter(aLock)
          If theNumbers.Contains(l) Then 'is PRN in the list
            'PRN repeated
            Threading.Interlocked.Exchange(repeat, l) 'store repeated number
            Threading.Interlocked.Increment(found) 'indicate found
          Else
            'PRN did not repeat
            theNumbers.Add(l)
          End If
          Threading.Monitor.Exit(aLock)
        Loop While Threading.Interlocked.Read(found) = 0L
      End Sub
    
    


    Subnet Calculator / Planner      Serial Port
    Thursday, August 5, 2010 3:53 PM
  • "that the odds you will RANDOMLY remove the same card at Step 5"

    But the distincton was about random numbers not "randomly".

    Renee

    Thursday, August 5, 2010 5:16 PM
  • Random Numbers

    Ain't no such animal.

    (mathematics) A listing of numbers which is nonrepetitive and satisfies no algorithm.

    Becomes a religious question.  If the universe is only 8000 years old, is there any random process?

    Thursday, August 5, 2010 6:22 PM
  • "that the odds you will RANDOMLY remove the same card at Step 5"

    But the distincton was about random numbers not "randomly".

    Renee

    Renee also said "The shuffle is good at producing unique numbers but not random numbers because true random numbers do repeat."  I can't find a reference that says "...true random numbers do repeat ." 

     

    I do find many references that state that the probability of any number being selected from a set of numbers N is 1/N.  If you toss a coin 100 times the probability is that you will get 50 heads and 50 tails, but randomness doesn't care for probability, so if you get 100 tails it is still random.

     

    I am done with this thread.  IMHO Renee you have been wrong from the start, and have abused all of us that dared say that.  Just apologize and stop.

     

     


    Subnet Calculator / Planner       Serial Port
    Thursday, August 5, 2010 7:09 PM
  • " am done with this thread.  IMHO Renee you have been wrong from the start, and have abused all of us that dared say that.  Just apologize and stop."

    No. Because I have not been wrong. I've had training in this which makes your opinion, just that ...an unsupported opinion. What is your opinion in a reality based domain of knowledge? It's actually worth little.

    Renee

    Thursday, August 5, 2010 7:34 PM
  • " If you toss a coin 100 times the probability is that you will get 50 heads and 50 tails, but randomness doesn't care for probability, so if you get 100 tails it is still random."

    Randomness cares a great deal about probality. For instance, in a random sample, the probabilty of coming up with 100 out of 100 heads is: 1/(2*50). Thats an example of probabilty in spite of your saying "randomness doesn't care for probability". It does care. How many times have you seen me use the term equiprobale in this thread? Those are statements involving probabiliy which makes much difference to random numbers of numeric distributions. Although, technically you are correct. Randoness does not care about anything. But random distributions do have probabilities.

    So , I have not been wrong no matter how much you would like me to be, because I know randoness.

    Renee

    Thursday, August 5, 2010 7:55 PM
  • Renee:

    So I'm sure to always use true Random Numbers in the future, could you supply me with your list of Random Numbers and a rigorous proof that they are indeed Random Numbers.

    Thursday, August 5, 2010 8:13 PM
  • Random numbers are repetitive (1/N)/places where N = the number of different digits than occur in a series of numbers and places represents how large a number is to a base.

    Pobabilty is not an algorithm to be followed. Probabilty is the degree to which a number can be predicted.

    But you are correct in this - all random lists are generated.

    Renee

    Thursday, August 5, 2010 8:14 PM
  • Yes,

    If I needed a table of random numbers, I'd use Runyon and Haber, authors of Fundamentals of Behavioral Satistics.

    They are not incorrect in what they say. BUT I had a year of Doctoral statistics and I dont remember any books in those courses except a book on non-parametric statistics.

    I have Runyon and Haber a few feet from me.

    Renee

    Thursday, August 5, 2010 8:23 PM
  • This thread has generated a number of views about what constitutes a random number. There seems to be some confusion about what such a beast is. Here's an attempt to shed some light.
    To start with we need some idea of what is meant by randomness. There's a whole philosophical debate we could have. However, it would be better to start with a reasonable defintion such as the following:

    From WikiPedia:
    ...randomness implies a lack of predictability. More formally, in statistics, a random process is a repeating process whose outcomes follow no describable deterministic pattern, but follow a probability distribution, such that the relative probability of the occurrence of each outcome can be approximated or calculated.

    Given this, a random number is one drawn from a sequence of numbers generated by some repeating process such that the next number in the sequence cannot be predicted with certainty. This holds no matter how long the sequence we have already generated. THis does not however stop us from making a probabilistic prediction. To do that we need either to know the underlying distribution or to have a sufficiently large sample to form an approximation to the distribution. Where the question of what is a sufficiently large sample is deliberately left unanswered (largely because there is no simple answer).
    With this in view there are a number of what I have termed myths that need to be addressed.

    Myth 1. The underlying distribution must be uniform.
    Not so. All we need is to have a sequence where we cannot predict the next number with certainty. Consider for example throwing two fair six-sided dice and adding the upper face values to get a  score. This will generate a sequence of scores between 2 and 12. No matter how long a (finite) sequence of throws we cannot predict with certainty what the next score will be. We can however predict that 7 will occur more often than any other score (1/6 of the time, approximately) and that 2 and 12 will occur least frequently (1/36 of the time).

    Myth 2. The sequence will repeat after sometime.
    Usually, this is meant in the context of a uniform distribution with N distinct values. Obviously after N numbers have neen generated there must be at least one repetiton after the N+1 selection (either there already has been one or the N+1 number is a repetition). However that does not mean the sequence will repeat. If it does then it is not a sequence of random numbers because knowing the sequence allows prediction with certainty.

    Myth 3. Each number in the sequence must be equiprobable.
    This is Myth 1 in disguise, i.e. it is the same as having a uniform distribution.

    Myth 4. Statistical tables of random numbers are random numbers, i.e. the process used to generate them is a random one.
    This is not so, e.g. one of the earliest such tables was generated by Kendall and Babbington Smith in 1939. They produced a sequence of 100000 digits (0 to 9). Divided them into blocks of 100 digits and subjected them to statistical tests. Some of the blocks were discarded because they failed the tests; others because they did not look random (e.g. had a longish subsequence of 0s). (For details see Philosophical Theories Of Probability (Donald Gillies, Routledge, London 2000.) Gillies quotes K&BS as saying "A set of Random Sampling Numbers ... must therefore conform to certain requirements other than that of having been chosen at random."

    Myth 5. Computers always generate uniformly distributed random numbers.
    There's a certain sense in which this is true. The method used is often some form of linear congruentiall generator with fairly large period. To all intents and purposes these can be considered random for every day use. However, they clearly are not since, given a long enough sequence (i.e. greater than the period), we can predict the next number with certainty. These generators also produce (approximate) uniform distributions. However, there is in principle no reason that some other form of generator could not be used.

    Myth 6. You cannot generate random numbers using a process that does not allow replacement.
    There's a sense in which this is true but it is not always the case. It is true if the process totally prohibits replacement. However, if the process draws a small sample without replacement and then replaces the drawn numbers and repeats the process it is not necessarily true. For example, consider the UK lottery. At each draw 6 numbers are selected from 49 possible numbers (I ignore the bonus ball). For the following draw the numbers are replaced and 6 numbers are selected. Now consider the sequence of numbers (in the order drawn) over the history of the lottery. Can you predict, with certainty, the next 6 numbers to be drawn? (If you can, please send me the formula you use to calculate them.) I would argue that the sequence has the necessary characteristics to constitute a sequence of random numbers in the range 1 to 49. The point is that the sample (i.e. 6 numbers) at each draw is relatively small compared with the range of possible numbers, and that any knowledge of the previous draws does not allow you to predict the next draw. Even in a single draw knowledge of the numbers drawn so far does not allow you to predict (with certainty) the next number that will be selected. It does allow you to say with certainty which numbers won't be selected i.e. those that have already been selected. But that does not significantly affect your ability to predict the next number correctly. For the first number you have a 1 in 49 chance of being correct; for the sixth number a 1 in 44 chance.

    Myth 7. Not really about random numbers!
    When some one uses Random Numbers as the tile for their post, they mean random number in the technical sense. This is false on two counts. Firstly, it attributes a specific meaning to the title whereas the title is (perhaps, ought to be) an indication of the problem area. Furthermore, it should be taken in the context of the forum. A title such as Random Numbers indicates that the problem is something to do with how to use the random number generator in VB. Secondly, there is an assumption that the title actually relates to the poster's problem as opposed to what the poster thinks is the problem. An example from another forum is the title "How to compare two texts files?" Which leads you to believe that the poster wants to compare two text files. The actual problem was how to remove duplicated records from a text file where the file was unordered. (The poster had come up with a bizarre approach that involved copying the file, iterating through the copy comparing it with the original and writing lines that did not match to a third file.) So, whatever the title, it is the body of the post that determines the problem. The fact that title and body sometimes have nothing to do with each other is beside the point. In fact the title could have been chosen 'at random'.

    That's a long and not entirely random ramble.


    Regards David R --------------------------------------------------------------- "Every program eventually becomes rococo, and then rubble." - Alan Perlis The only valid measurement of code quality: WTFs/minute.
    Thursday, August 5, 2010 11:54 PM
  •  

    I thought I would reply;

    From WikiPedia:

    First of all your source is the most questionable. No one from acadenia would name Wikipedia a resource.

    "...randomness implies a lack of predictability. More formally, in statistics, a random process is a repeating process whose outcomes follow no describable deterministic pattern, but follow a probability distribution, such that the relative probability of the occurrence of each outcome can be approximated or calculated."

    This is exactly what I've said.

    Given this, a random number is one drawn from a sequence of numbers generated by some repeating process such that the next number in the sequence cannot be predicted with certainty. This holds no matter how long the sequence we have already generated. THis does not however stop us from making a probabilistic prediction. To do that we need either to know the underlying distribution or to have a sufficiently large sample to form an approximation to the distribution. Where the question of what is a sufficiently large sample is deliberately left unanswered (largely because there is no simple answer).

    The fact that there is no simple answer is only an impedient to lay people. Simple answers in that formulas have been established.

    With this in view there are a number of what I have termed myths that need to be addressed.

    Myth 1. The underlying distribution must be uniform.

    I have stated that the underlying distribution must be random.

    Not so. All we need is to have a sequence where we cannot predict the next number with certainty. Consider for example throwing two fair six-sided dice and adding the upper face values to get a  score. This will generate a sequence of scores between 2 and 12. No matter how long a (finite) sequence of throws we cannot predict with certainty what the next score will be. We can however predict that 7 will occur more often than any other score (1/6 of the time, approximately) and that 2 and 12 will occur least frequently (1/36 of the time).

    Yes, you can predict that knowing previous outcomes or by prediction.

    Myth 2. The sequence will repeat after sometime.

    Usually, this is meant in the context of a uniform distribution with N distinct values. Obviously after N numbers have neen generated there must be at least one repetiton after the N+1 selection (either there already has been one or the N+1 number is a repetition). However that does not mean the sequence will repeat. If it does then it is not a sequence of random numbers because knowing the sequence allows prediction with certainty.

    Consider the following:

    The distribution occurs to two places. Number in such a distribution can occur at any time. Except in cases where the outcome is discarded, such as in a shuffle. Then the distribution is not random.

    Myth 3. Each number in the sequence must be equiprobable.

    This is Myth 1 in disguise, i.e. it is the same as having a uniform distribution.

    Myth 4. Statistical tables of random numbers are random numbers, i.e. the process used to generate them is a random one.

    This is not so, e.g. one of the earliest such tables was generated by Kendall and Babbington Smith in 1939. They produced a sequence of 100000 digits (0 to 9). Divided them into blocks of 100 digits and subjected them to statistical tests. Some of the blocks were discarded because they failed the tests; others because they did not look random (e.g. had a longish subsequence of 0s). (For details see Philosophical Theories Of Probability (Donald Gillies, Routledge, London 2000.) Gillies quotes K&BS as saying "A set of Random Sampling Numbers ... must therefore conform to certain requirements other than that of having been chosen at random."

    This bears some discussion. Tests will fail at statistical rates. This is what a statistical distribution means.

    Myth 5. Computers always generate uniformly distributed random numbers.

    There's a certain sense in which this is true. The method used is often some form of linear congruentiall generator with fairly large period. To all intents and purposes these can be considered random for every day use. However, they clearly are not since, given a long enough sequence (i.e. greater than the period), we can predict the next number with certainty. These generators also produce (approximate) uniform distributions. However, there is in principle no reason that some other form of generator could not be used.

    " congruentiall" is not a word in english.

    Myth 6. You cannot generate random numbers using a process that does not allow replacement.

    There's a sense in which this is true but it is not always the case. It is true if the process totally prohibits replacement. However, if the process draws a small sample without replacement and then replaces the drawn numbers and repeats the process it is not necessarily true. For example, consider the UK lottery. At each draw 6 numbers are selected from 49 possible numbers (I ignore the bonus ball). For the following draw the numbers are replaced and 6 numbers are selected. Now consider the sequence of numbers (in the order drawn) over the history of the lottery. Can you predict, with certainty, the next 6 numbers to be drawn? (If you can, please send me the formula you use to calculate them.) I would argue that the sequence has the necessary characteristics to constitute a sequence of random numbers in the range 1 to 49. The point is that the sample (i.e. 6 numbers) at each draw is relatively small compared with the range of possible numbers, and that any knowledge of the previous draws does not allow you to predict the next draw. Even in a single draw knowledge of the numbers drawn so far does not allow you to predict (with certainty) the next number that will be selected. It does allow you to say with certainty which numbers won't be selected i.e. those that have already been selected. But that does not significantly affect your ability to predict the next number correctly. For the first number you have a 1 in 49 chance of being correct; for the sixth number a 1 in 44 chance.

    Here the definition of randomness has been changed. The defintion is that 1/N and here n=10, occur with equiprobability which is not occurring.

    Myth 7. Not really about random numbers!

    When some one uses Random Numbers as the tile for their post, they mean random number in the technical sense. This is false on two counts. Firstly, it attributes a specific meaning to the title whereas the title is (perhaps, ought to be) an indication of the problem area. Furthermore, it should be taken in the context of the forum. A title such as Random Numbers indicates that the problem is something to do with how to use the random number generator in VB. Secondly, there is an assumption that the title actually relates to the poster's problem as opposed to what the poster thinks is the problem. An example from another forum is the title "How to compare two texts files?" Which leads you to believe that the poster wants to compare two text files. The actual problem was how to remove duplicated records from a text file where the file was unordered. (The poster had come up with a bizarre approach that involved copying the file, iterating through the copy comparing it with the original and writing lines that did not match to a third file.) So, whatever the title, it is the body of the post that determines the problem. The fact that title and body sometimes have nothing to do with each other is beside the point. In fact the title could have been chosen 'at random'.

    First of all, I agree with some points, after all the points are my reason for writing. My point is that "random" has meaning and that people do not know that because often they contadict themselves. For example, asking for Random numbers that do not repeat is an error because random numbers do repeat themselves.

    That's a long and not entirely random ramble.

    It was random at all and it was not all correct.

    Renee

    Friday, August 6, 2010 12:12 PM
  • Here's a rejoinder to your reply (I have italicised quotes from my previous post; made bold quotes from your response).

    First of all your source is the most questionable. No one from acadenia would name Wikipedia a resource.
    Two points:
    1 This is not academia it's a public forum so it does not require academic references. An academic resource might be Gillies' book referred to in my previous post.
    2 The source is unimportant, what is important is that you agree with the definition, so there is no real problem. To quote "This is exactly what I've said."

    Where the question of what is a sufficiently large sample is deliberately left unanswered (largely because there is no simple answer).
    The fact that there is no simple answer is only an impedient to lay people. Simple answers in that formulas have been established.
    Suppose I have a sequence of numbers that are known to be generated by a random process but the underlying distribution is unknown.
    How large must the sequence be to determine the underlying distribution? I.e. what are the formulae that tell me how to calculate the minimum size of the sequence to be able to determine the distribution? Do the formulae allow you to determine the distribution with certainty?

    Myth 1. The underlying distribution must be uniform.
    I have stated that the underlying distribution must be random.
    But that does not mean uniformly distributed. Unless you are claiming that the scores in the two-dice game are not random.
    To be extra picky, a probability distribution is not random. It identifies the probabilities of each value of a random variable. The probabilities of the variable taking particular values make up the distribution (assuming it is discrete).

    Yes, you can predict that knowing previous outcomes or by prediction.
    Not sure if you are claiming that the prediction is with certainty or not. In the case of two-dice, I can predict the next number will be 7, but the probability that 7 actually occurs is 1/6. So on average I'll be wrong 5 out of 6 times.

    Myth 5. Computers always generate uniformly distributed random numbers.
    congruentiall" is not a word in English.
    A spelling error - should be congruential, as in linear congruential generator. (BTW there are no such words as "acadenia" or "impedient" in English. :))

    Myth 6. You cannot generate random numbers using a process that does not allow replacement.
    Here the definition of randomness has been changed. The defintion is that 1/N and here n=10, occur with equiprobability which is not occurring.
    No the definition is unchanged - it remains that "the sequence is random if you cannot predict with certainty what the next number will be in the sequence", no matter how long the sequence you already know. And that is the case with UK lottery numbers. You have introduced a new definition that requires equal probabilities (hence a uniform distribution) and that's just Myth 1.

    ... asking for Random numbers that do not repeat is an error because random numbers do repeat themselves
    I never said they did not. My second sentence under Myth 2 makes this clear: "Obviously after N numbers have been generated there must be at least one repetition after the N+1 selection (either there already has been one or the N+1 number is a repetition)."
    What I said was that the sequence does not repeat. More formally, given a sequence of length M if the subsequent values are all of the form X(k*M+i) = X(i) the sequence is not random (where X(k*M+i) is the (k*M+i)th value, X(i) is the ith value for i<=M, k = 1, 2, 3, ...). It is not random because given any X(j), where j<=M, I can predict with certainty the X(M+j)th, X(2M+j)th, X(3M+j)th,... values. More technically I suppose I should have said that in a sequence of length N, if there is a sub-sequence of length M (where M<N, some would say M<<N) that recurs for all X(j) where j>M the sequence is not random. (And I'm not even sure I've got that precisely correct - but this is not an academic paper!)

    I think where we fundamentally disagree is in the relation between randomness and the uniform distribution. Equating the two is, implicitly, appealing to the Principle of Indifference (formerly known as the Principle of Insufficient Reason). However there are problems with the Principle of Indifference that lead to a number of paradoxes (e.g. Bertrand's Paradox). These paradoxes can be resolved, but resolution involves limiting the distribution to a finite indivisible set of values (see JM Keynes A Treatise On Probability for a succinct exposition of the Principle.) However the resolution rules out variables with continuous values.
    Perhaps you want to restrict the term 'random number' to e.g. those presented in a book of statistical tables? These are usually constructed to form a uniform distribution of digits. Consider however the following procedure. I administer IQ tests to a million people. Their scores are recorded and written on slips of paper. The slips of paper are placed in a (large) box with a hand sized hole. Slips are drawn out through the hole (I can shake the box between draws but it's not essential). As each slip is drawn out it is typed into a table of 20 columns on sheets of paper. At the end of the process I have a table of random numbers. Given a standard IQ test the numbers will be (approximately) Normally distributed with mean 100 and standard deviation 15 (depends on the IQ test but most are scaled to give sd=15). Whether they are exactly Normally distributed is not important, what is important is that they are not uniformly distributed yet still form a table of random numbers. At least I would claim they do since they could be used to produce a sample in the same way that other published tables do. It's just that the distribution would be different, but that's not a problem if you require a sample drawn from a Normal distribution.

    Regards David R --------------------------------------------------------------- "Every program eventually becomes rococo, and then rubble." - Alan Perlis The only valid measurement of code quality: WTFs/minute.
    Friday, August 6, 2010 8:15 PM
  •  

    adding the value of 2 dices dont give a random number, it is a process

    if a random number dont follow a normal distribution, then the chi-square law and the chi-square test are false ?!?!?!

    Saturday, August 7, 2010 11:20 AM
  • The chi-square is not false. Adding a constant to a group of  numbers doesn't do anything to it's statistical frequency.

    Renee

    Saturday, August 7, 2010 11:35 AM
  • Here's a rejoinder to your reply (I have italicised quotes from my previous post; made bold quotes from your response).

    First of all your source is the most questionable. No one from acadenia would name Wikipedia a resource.
    Two points:
    1 This is not academia it's a public forum so it does not require academic references. An academic resource might be Gillies' book referred to in my previous post.

    But I require a respectable reference other wise it's not worth reading.


    2 The source is unimportant, what is important is that you agree with the definition, so there is no real problem. To quote "This is exactly what I've said."

    In some cases - yes. And that's the problem. Reliability.



    Where the question of what is a sufficiently large sample is deliberately left unanswered (largely because there is no simple answer).
    The fact that there is no simple answer is only an impedient to lay people. Simple answers in that formulas have been established.
    Suppose I have a sequence of numbers that are known to be generated by a random process but the underlying distribution is unknown.
    How large must the sequence be to determine the underlying distribution? I.e. what are the formulae that tell me how to calculate the minimum size of the sequence to be able to determine the distribution? Do the formulae allow you to determine the distribution with certainty?

    Myth 1. The underlying distribution must be uniform.
    I have stated that the underlying distribution must be random.
    But that does not mean uniformly distributed.

    No, it does not. But there are many characteristics to a distribution. Randoness implies a uniform distribution. 

     Unless you are claiming that the scores in the two-dice game are not random.
    To be extra picky, a probability distribution is not random. It identifies the probabilities of each value of a random variable. The probabilities of the variable taking particular values make up the distribution (assuming it is discrete).

    Yes, you can predict that knowing previous outcomes or by prediction.
    Not sure if you are claiming that the prediction is with certainty or not. In the case of two-dice, I can predict the next number will be 7, but the probability that 7 actually occurs is 1/6. So on average I'll be wrong 5 out of 6 times.

    Certainty, in a probalistic sense is specified.

    Myth 5. Computers always generate uniformly distributed random numbers.
    congruentiall" is not a word in English.
    A spelling error - should be congruential, as in linear congruential generator. (BTW there are no such words as "acadenia" or "impedient" in English. :))

    Myth 6. You cannot generate random numbers using a process that does not allow replacement.
    Here the definition of randomness has been changed. The defintion is that 1/N and here n=10, occur with equiprobability which is not occurring.
    No the definition is unchanged - it remains that "the sequence is random if you cannot predict with certainty what the next number will be in the sequence", no matter how long the sequence you already know. And that is the case with UK lottery numbers. You have introduced a new definition that requires equal probabilities (hence a uniform distribution) and that's just Myth 1.

    But that is a NOT the definition I have been using at all, and I have been talking about radom numbers and randow distributions. The definition I have been using relies on probabilities and can be calculated.

    ... asking for Random numbers that do not repeat is an error because random numbers do repeat themselves
    I never said they did not. My second sentence under Myth 2 makes this clear: "Obviously after N numbers have been generated there must be at least one repetition after the N+1 selection (either there already has been one or the N+1 number is a repetition)."
    What I said was that the sequence does not repeat. More formally, given a sequence of length M if the subsequent values are all of the form X(k*M+i) = X(i) the sequence is not random (where X(k*M+i) is the (k*M+i)th value, X(i) is the ith value for i<=M, k = 1, 2, 3, ...). It is not random because given any X(j), where j<=M, I can predict with certainty the X(M+j)th, X(2M+j)th, X(3M+j)th,... values. More technically I suppose I should have said that in a sequence of length N, if there is a sub-sequence of length M (where M<N, some would say M<<N) that recurs for all X(j) where j>M the sequence is not random. (And I'm not even sure I've got that precisely correct - but this is not an academic paper!)

    Why not ?

    The sequence is not defined.


    I think where we fundamentally disagree is in the relation between randomness and the uniform distribution. Equating the two is, implicitly, appealing to the Principle of Indifference (formerly known as the Principle of Insufficient Reason). However there are problems with the Principle of Indifference that lead to a number of paradoxes (e.g. Bertrand's Paradox). These paradoxes can be resolved, but resolution involves limiting the distribution to a finite indivisible set of values (see JM Keynes A Treatise On Probability for a succinct exposition of the Principle.) However the resolution rules out variables with continuous values.
    Perhaps you want to restrict the term 'random number' to e.g. those presented in a book of statistical tables? These are usually constructed to form a uniform distribution of digits. Consider however the following procedure. I administer IQ tests to a million people. Their scores are recorded and written on slips of paper. The slips of paper are placed in a (large) box with a hand sized hole. Slips are drawn out through the hole (I can shake the box between draws but it's not essential). As each slip is drawn out it is typed into a table of 20 columns on sheets of paper. At the end of the process I have a table of random numbers. Given a standard IQ test the numbers will be (approximately) Normally distributed with mean 100 and standard deviation 15 (depends on the IQ test but most are scaled to give sd=15). Whether they are exactly Normally distributed is not important, what is important is that they are not uniformly distributed yet still form a table of random numbers. At least I would claim they do since they could be used to produce a sample in the same way that other published tables do. It's just that the distribution would be different, but that's not a problem if you require a sample drawn from a Normal distribution.

    I would claim the distribution is not random. The numbers may not be predictable but that's only a piece of a random distribution. For one thing the numbers lack the principle of uniformity. The distribution will be a bell curve. It is not a random distribution to begin with. Admittedly the numbers are unpredictable but not random. Theres a difference.

    Renee

    Saturday, August 7, 2010 12:08 PM
  • I agree the problem is principally one of definition, but think there are also practical implications. If you look at e.g. Von Mises's fromulation of probability he uses two axioms in his relative frequency approach: The Axiom Of Convergence and the Axiom Of Randomness (or Law of Excluded Gambling Systems). Neither axiom refers to uniform distributions. And I don't think subsequent developments, such as Kolmogorov's Axioms or Popper's Propensity Theory, do so. Indeed it could be argued that one of the aims of modern approaches is to dispense with the assumption of uniformity or equiprobability that underlies classical treatments.
    In support of my view that "random number" does not imply uniformity here's some evidence that I'm not the only one who thinks so.

    Statistics Tables: For Mathematicians, Engineers, Economists And The Behavioural Management Sciences
    Henry R Neave, Routledge (1978); New edition edition (1998) ISBN: 0415104858
    From table of contents:
       Section 7 Random Numbers
          7.1 random digits    59
          7.2 random numbers from the standard Normal distribution    61
          7.3 random numbers from the exponential distribution with unit mean    62
    From Description of Tables:
       Table 7.1 gives 5000 random digits arranged in blocks of five for ease of reading. (Subsequent text indicates these are Uniformly distributed but there is no explicit statement to that effect.)
       Table 7.2 gives 500 random numbers generated from the standard normal distribution N(0,1)
       Table 7.3 gives 500 random numbers generated from the exponential distribution with mean 1, having probability density function f(x)=e^(-x) (x>=0)

    Clearly the author is quite happy to apply "random number" to non-uniform distributions. Interestingly he does not describe the uniform digits as "random numbers". A quick check of two (rather old i.e. 1970s) text books has them describing their tables as "Equiprobable Random Digits" and "Uniformly Distributed Random Digits". So they don't apply the term "random number" to uniformly distributed values.

    There is another take on this. Consider the following experiment. I have a bag with 10 numbered balls: one is numbered 1, two are numbered 2, three are numbered 3 and four are numbered 4. A ball is selected at random and its number recorded. The ball is replaced , the bag is shook and another ball is selected. Randomness requires that each ball has the same chance as any other ball and this requirement is met. However, the distribution of numbers drawn is not uniform: 4 is twice as likely as 2 in the distribution. If the balls are distinguishable by something other than number (e.g. by colour) and this is also recorded then we can get a uniform distribution. But this would not be a uniform distribution of numbers but of number and colour.

    It's all very interesting philosophically, but the reality is that many generators in common use do produce uniform distributions (I'm thinking of those in most programming languages) so there is a tendency to equate random numbers with uniformly distributed random numbers. However it does not have to be the case IIRC Simula67 provided a number of generators for Uniform, Normal, Poisson, Exponential and (possibly) other distributions.


    Regards David R --------------------------------------------------------------- "Every program eventually becomes rococo, and then rubble." - Alan Perlis The only valid measurement of code quality: WTFs/minute.
    Wednesday, August 11, 2010 10:55 AM