Loading ...
Sorry, an error occurred while loading the content.

Re: [PBML] Random Number Generator

Expand Messages
  • Bryan Irvine
    Oh hehe lol, ya i understood the sparrow thing :-) Note: i reposted some better code a couple minutes after i sent that cannon :-)
    Message 1 of 26 , Oct 1, 2002
    • 0 Attachment
      Oh hehe lol, ya i understood the sparrow thing :-)



      Note: i reposted some better code a couple minutes after i sent that
      "cannon" :-)



      On Tue, 2002-10-01 at 09:36, Jenda Krynicky wrote:
      > From: Bryan Irvine <bryan.irvine@...>
      >
      > > Wouldn't they both have the same potential for an infinite loop?
      > > I like yours better, it looks cleaner, but does it not have the same
      > > problems? ie. the number generator for some reason never generates a
      > > number of 5 or higher? (highly improbable i know, but you could run
      > > into instances where it just takes a long time to finish processing).
      > >
      > > Bryan Irivne
      > >
      >
      > Oooops. MY POST WAS JUST A JOKE!
      >
      > > On Tue, 2002-10-01 at 08:59, Jenda Krynicky wrote:
      > > > If we are gonna try and shoot the sparrow with a cannon, why
      > > > couldn't we use a recursive function?
      > > >
      > > > ...
      >
      > In Czech "to go and shoot a sparrow with a cannon" means to use
      > something very big to do something very small. To take a tool that's
      > too powerfull for the task. To do something complex if something dead
      > simple would be enough.
      >
      > Jenda
      > =========== Jenda@... == http://Jenda.Krynicky.cz ==========
      > There is a reason for living. There must be. I've seen it somewhere.
      > It's just that in the mess on my table ... and in my brain
      > I can't find it.
      > --- me
      >
      >
      >
      > Unsubscribing info is here: http://help.yahoo.com/help/us/groups/groups-32.html
      >
      > Your use of Yahoo! Groups is subject to http://docs.yahoo.com/info/terms/
      >
      >
    • Bryan Irvine
      I _DID_ tell him to add 5 in one of mine and even gave some code...so he needs to start reading and not get so frustrated. If you are still on the list, calm
      Message 2 of 26 , Oct 1, 2002
      • 0 Attachment
        I _DID_ tell him to add 5 in one of mine and even gave some code...so he
        needs to start reading and not get so frustrated.

        If you are still on the list, calm down a smidge...

        sheesh!



        On Tue, 2002-10-01 at 19:16, Jenda Krynicky wrote:
        > From: "RicK" <rik408@...>
        >
        > > Know what?
        > > I think I can do without this group.
        > > I asked a simple question, and all I got back were condescending and
        > > patronizing remarks. I thought this was a group for beginning Perl
        > > programmers, but I see a few big fish living in this little pond.
        > > Sorry for asking my question. Actually a large part of the class had
        > > problems with it. We all thought it was a bit much to ask us to do in
        > > the FIRST week of class. Anyway, thanks for making a newcomer feel so
        > > "welcome".
        > >
        > > Outtie,
        > > Rick
        >
        > I'm sorry if you feel offended.
        >
        > I really could not believe someone could have problems with this if
        > he tried.
        >
        > If you want to be angry on someone, be angry at your math teacher.
        > He/She aparently did not do his/her job well.
        >
        > In this case instead of telling you to add 5 to the rand(10), we
        > tried to give you hints. Instead of giving you a fish we all tried to
        > force you to learn to fish.
        >
        > Programming is NOT writing code, programming is solving problems!
        > You can't expect to find the solution to each and every of your
        > problems in a book or be taught in lessons. YOU are the one who is
        > supposed to find solutions. Writing the code is the easy part,
        > finding the solution, considering all posible cases and errors is the
        > hard part. But that's what YOU are (will be) there for.
        >
        > Jenda
        > P.S.: As for what this group is for. This group IS for beginning Perl
        > programmers. It was made to aid in their LEARNING.
        > It's up to you if you stay, but be prepared to get hints instead of
        > solutions. And be prepared to look stupid from time to time. We all
        > use(d) to.
        > == Jenda@... == http://Jenda.Krynicky.cz ==
        > I wonder why the whole chemistry industry ignores
        > computer bugs. We all would gladly pay big bucks
        > for a functional insecticide.
        >
        >
        >
        > Unsubscribing info is here: http://help.yahoo.com/help/us/groups/groups-32.html
        >
        > Your use of Yahoo! Groups is subject to http://docs.yahoo.com/info/terms/
        >
        >
      • Bryan Irvine
        he got a _TON_ of hints and several examples of code even, I can think of 4 although 2 were what jenda would call a cannon ;-) Bryan
        Message 3 of 26 , Oct 1, 2002
        • 0 Attachment
          he got a _TON_ of hints and several examples of code even, I can think
          of 4 although 2 were what jenda would call a "cannon" ;-)

          Bryan

          On Tue, 2002-10-01 at 20:56, Sean Correia wrote:
          > > It may come across as condesending, but its not really..
          >
          > I disagree. He didn't ask for a mentor, he asked a question. It's his problem if he wants to shortcut the learning process not our concern to babysit him and offer him friendly advice. I am sure there are other groups for that.
          >
          > > imagine what your
          > > teacher would think if you handed him some really excellent code that
          > > answers the question perfectly.. I imagine he/she would
          > > rightly assume that
          > > you "had alot of help"
          >
          > Imagine what some people's bosses would think if they found out their 'programmers' were asking questions about stuff they should already know.
          >
          > It's bullshit that if someone asks a homework related question he gets no answer and hints, but if someone asks a job related question they get whole programs.
          >
          > Just my .02
          >
          > Cheers,
          > Sean
          >
          >
          > Unsubscribing info is here: http://help.yahoo.com/help/us/groups/groups-32.html
          >
          > Your use of Yahoo! Groups is subject to http://docs.yahoo.com/info/terms/
          >
          >
        • SykkN
          I think that this would work rather well. ============================================ #!/usr/bin/perl -w srand(time() / $$); while(1) { @numberList = (5..10);
          Message 4 of 26 , Oct 1, 2002
          • 0 Attachment
            I think that this would work rather well.

            ============================================
            #!/usr/bin/perl -w

            srand(time() / $$);

            while(1) {
            @numberList = (5..10);
            $randomNumber = $numberList[rand(@numberList)],"\n";
            print $randomNumber,"\n";
            sleep 1;
            }
            =============================================


            SykkN
            talk: sykkn@...
            visit: http://www.linuxforums.org
          • Bryan Irvine
            Wouldn t they both have the same potential for an infinite loop? I like yours better, it looks cleaner, but does it not have the same problems? ie. the number
            Message 5 of 26 , Oct 1, 2002
            • 0 Attachment
              Wouldn't they both have the same potential for an infinite loop?
              I like yours better, it looks cleaner, but does it not have the same
              problems? ie. the number generator for some reason never generates a
              number of 5 or higher? (highly improbable i know, but you could run into
              instances where it just takes a long time to finish processing).

              Bryan Irivne


              On Tue, 2002-10-01 at 08:59, Jenda Krynicky wrote:
              > From: Bryan Irvine <bryan.irvine@...>
              > > I'm not gonna test it out as it is indeed for homework. I might try
              > > something like this
              > >
              > > $number = rand(15);
              > > while ("$number" < 5){
              > > $number = rand(15);
              > > }
              > > print "$number";
              > >
              > > I'm no perl wizard, but that should generate a random number of 15 or
              > > lower, test it to make sure it is lower than 5 if not run it again.
              >
              > If we are gonna try and shoot the sparrow with a cannon, why couldn't
              > we use a recursive function?
              >
              >
              > sub my_rand {
              > my $number = rand(15);
              > if ($number < 5){
              > return my_rand();
              > } else {
              > return $number ;
              > }
              > }
              >
              > print my_rand();
              >
              > Jenda
              > =========== Jenda@... == http://Jenda.Krynicky.cz ==========
              > There is a reason for living. There must be. I've seen it somewhere.
              > It's just that in the mess on my table ... and in my brain
              > I can't find it.
              > --- me
              >
              >
              >
              > Unsubscribing info is here: http://help.yahoo.com/help/us/groups/groups-32.html
              >
              > Your use of Yahoo! Groups is subject to http://docs.yahoo.com/info/terms/
              >
              >
            • Jenda Krynicky
              From: Bryan Irvine ... Oooops. MY POST WAS JUST A JOKE! ... In Czech to go and shoot a sparrow with a cannon means to use
              Message 6 of 26 , Oct 1, 2002
              • 0 Attachment
                From: Bryan Irvine <bryan.irvine@...>

                > Wouldn't they both have the same potential for an infinite loop?
                > I like yours better, it looks cleaner, but does it not have the same
                > problems? ie. the number generator for some reason never generates a
                > number of 5 or higher? (highly improbable i know, but you could run
                > into instances where it just takes a long time to finish processing).
                >
                > Bryan Irivne
                >

                Oooops. MY POST WAS JUST A JOKE!

                > On Tue, 2002-10-01 at 08:59, Jenda Krynicky wrote:
                > > If we are gonna try and shoot the sparrow with a cannon, why
                > > couldn't we use a recursive function?
                > >
                > > ...

                In Czech "to go and shoot a sparrow with a cannon" means to use
                something very big to do something very small. To take a tool that's
                too powerfull for the task. To do something complex if something dead
                simple would be enough.

                Jenda
                =========== Jenda@... == http://Jenda.Krynicky.cz ==========
                There is a reason for living. There must be. I've seen it somewhere.
                It's just that in the mess on my table ... and in my brain
                I can't find it.
                --- me
              • RicK
                Know what? I think I can do without this group. I asked a simple question, and all I got back were condescending and patronizing remarks. I thought this was a
                Message 7 of 26 , Oct 1, 2002
                • 0 Attachment
                  Know what?
                  I think I can do without this group.
                  I asked a simple question, and all I got back were condescending and
                  patronizing remarks. I thought this was a group for beginning Perl
                  programmers, but I see a few big fish living in this little pond.
                  Sorry for asking my question. Actually a large part of the class had
                  problems with it. We all thought it was a bit much to ask us to do in
                  the FIRST week of class.
                  Anyway, thanks for making a newcomer feel so "welcome".

                  Outtie,
                  Rick



                  --- In perl-beginner@y..., "Jenda Krynicky" <Jenda@K...> wrote:
                  > From: "RicK" <rik408@y...>
                  >
                  > > I already stated that I know how to generate a random number
                  between 1
                  > > and 10. It is essentially by multiplying the rand by 10:
                  > >
                  > > # print a random number between range of 0 and 10.
                  > > print("rand(), ", rand(10), "\n");
                  > >
                  > > I am not sure why everyone is being so coy about this.
                  > > Its not like I am trying to "cheat" on my homework or something.
                  > > I just thought it curious that we would be assigned a problem in
                  the
                  > > 2nd week of class where no reference on how to do it was in the
                  text,
                  > > and was not gone over in class. I was just wondering if anyone
                  had a
                  > > clue as to how this was done.
                  > >
                  > > rick
                  >
                  > Oh well ... may I ask you how old are you?
                  >
                  > This is not a programming problem, this is basic math!
                  >
                  > If you know X is between 0 and 10, how do you compute Y that would
                  be
                  > between 5 and 15?
                  >
                  > Or suppose you have a function f() that returns values in range 0
                  to
                  > 10, and you want to create a function g() whose chart would look
                  the
                  > same, except that the values would be between 5 and 15?
                  >
                  > THINK!
                  >
                  > Jenda
                  >
                  > =========== Jenda@K... == http://Jenda.Krynicky.cz ==========
                  > There is a reason for living. There must be. I've seen it somewhere.
                  > It's just that in the mess on my table ... and in my brain
                  > I can't find it.
                  > --- me
                • Jenda Krynicky
                  From: RicK ... I m sorry if you feel offended. I really could not believe someone could have problems with this if he tried. If you want
                  Message 8 of 26 , Oct 1, 2002
                  • 0 Attachment
                    From: "RicK" <rik408@...>

                    > Know what?
                    > I think I can do without this group.
                    > I asked a simple question, and all I got back were condescending and
                    > patronizing remarks. I thought this was a group for beginning Perl
                    > programmers, but I see a few big fish living in this little pond.
                    > Sorry for asking my question. Actually a large part of the class had
                    > problems with it. We all thought it was a bit much to ask us to do in
                    > the FIRST week of class. Anyway, thanks for making a newcomer feel so
                    > "welcome".
                    >
                    > Outtie,
                    > Rick

                    I'm sorry if you feel offended.

                    I really could not believe someone could have problems with this if
                    he tried.

                    If you want to be angry on someone, be angry at your math teacher.
                    He/She aparently did not do his/her job well.

                    In this case instead of telling you to add 5 to the rand(10), we
                    tried to give you hints. Instead of giving you a fish we all tried to
                    force you to learn to fish.

                    Programming is NOT writing code, programming is solving problems!
                    You can't expect to find the solution to each and every of your
                    problems in a book or be taught in lessons. YOU are the one who is
                    supposed to find solutions. Writing the code is the easy part,
                    finding the solution, considering all posible cases and errors is the
                    hard part. But that's what YOU are (will be) there for.

                    Jenda
                    P.S.: As for what this group is for. This group IS for beginning Perl
                    programmers. It was made to aid in their LEARNING.
                    It's up to you if you stay, but be prepared to get hints instead of
                    solutions. And be prepared to look stupid from time to time. We all
                    use(d) to.
                    == Jenda@... == http://Jenda.Krynicky.cz ==
                    I wonder why the whole chemistry industry ignores
                    computer bugs. We all would gladly pay big bucks
                    for a functional insecticide.
                  • Franki
                    actually, you got alot more hints then I usually do... This group is used to students asking questions here, and generally, its considered a bad thing to hand
                    Message 9 of 26 , Oct 1, 2002
                    • 0 Attachment
                      actually, you got alot more hints then I usually do...

                      This group is used to students asking questions here, and generally, its
                      considered a bad thing to hand the student the answer on a platter.. you got
                      an awful lot of hints on how to do it, none of them were condesending... if
                      they had handed you the answer, would you have learned as much as had you
                      worked it out for yourself???

                      I seem to learn more by this list NOT giving me answers, makes me search
                      google harder :-)

                      It may come across as condesending, but its not really.. imagine what your
                      teacher would think if you handed him some really excellent code that
                      answers the question perfectly.. I imagine he/she would rightly assume that
                      you "had alot of help"

                      I doubt he even expected too many "perfect answers" from his students, as
                      Jenda said, its more about learning to think in a certain way then it is
                      about the actual code.. thats a lessen I only learned recently...

                      I am sure that anyone here would have handed you the answer had no not
                      mentioned taking a class... Its like being told the end of a movie before
                      you see it.. it ruins the experience,, not to mention the benefit.

                      rgds

                      Franki



                      -----Original Message-----
                      From: RicK [mailto:rik408@...]
                      Sent: Wednesday, 2 October 2002 2:36 AM
                      To: perl-beginner@yahoogroups.com
                      Subject: [PBML] Re: Random Number Generator


                      Know what?
                      I think I can do without this group.
                      I asked a simple question, and all I got back were condescending and
                      patronizing remarks. I thought this was a group for beginning Perl
                      programmers, but I see a few big fish living in this little pond.
                      Sorry for asking my question. Actually a large part of the class had
                      problems with it. We all thought it was a bit much to ask us to do in
                      the FIRST week of class.
                      Anyway, thanks for making a newcomer feel so "welcome".

                      Outtie,
                      Rick



                      --- In perl-beginner@y..., "Jenda Krynicky" <Jenda@K...> wrote:
                      > From: "RicK" <rik408@y...>
                      >
                      > > I already stated that I know how to generate a random number
                      between 1
                      > > and 10. It is essentially by multiplying the rand by 10:
                      > >
                      > > # print a random number between range of 0 and 10.
                      > > print("rand(), ", rand(10), "\n");
                      > >
                      > > I am not sure why everyone is being so coy about this.
                      > > Its not like I am trying to "cheat" on my homework or something.
                      > > I just thought it curious that we would be assigned a problem in
                      the
                      > > 2nd week of class where no reference on how to do it was in the
                      text,
                      > > and was not gone over in class. I was just wondering if anyone
                      had a
                      > > clue as to how this was done.
                      > >
                      > > rick
                      >
                      > Oh well ... may I ask you how old are you?
                      >
                      > This is not a programming problem, this is basic math!
                      >
                      > If you know X is between 0 and 10, how do you compute Y that would
                      be
                      > between 5 and 15?
                      >
                      > Or suppose you have a function f() that returns values in range 0
                      to
                      > 10, and you want to create a function g() whose chart would look
                      the
                      > same, except that the values would be between 5 and 15?
                      >
                      > THINK!
                      >
                      > Jenda
                      >
                      > =========== Jenda@K... == http://Jenda.Krynicky.cz ==========
                      > There is a reason for living. There must be. I've seen it somewhere.
                      > It's just that in the mess on my table ... and in my brain
                      > I can't find it.
                      > --- me



                      Unsubscribing info is here:
                      http://help.yahoo.com/help/us/groups/groups-32.html

                      Your use of Yahoo! Groups is subject to http://docs.yahoo.com/info/terms/
                    • Sean Correia
                      ... I disagree. He didn t ask for a mentor, he asked a question. It s his problem if he wants to shortcut the learning process not our concern to babysit him
                      Message 10 of 26 , Oct 1, 2002
                      • 0 Attachment
                        > It may come across as condesending, but its not really..

                        I disagree. He didn't ask for a mentor, he asked a question. It's his problem if he wants to shortcut the learning process not our concern to babysit him and offer him friendly advice. I am sure there are other groups for that.

                        > imagine what your
                        > teacher would think if you handed him some really excellent code that
                        > answers the question perfectly.. I imagine he/she would
                        > rightly assume that
                        > you "had alot of help"

                        Imagine what some people's bosses would think if they found out their 'programmers' were asking questions about stuff they should already know.

                        It's bullshit that if someone asks a homework related question he gets no answer and hints, but if someone asks a job related question they get whole programs.

                        Just my .02

                        Cheers,
                        Sean
                      • Mike Dillinger
                        Original Message: From: Sean Correia Date: Tuesday October 01 2002 01:56PM PT SC Imagine what some people s bosses would think
                        Message 11 of 26 , Oct 1, 2002
                        • 0 Attachment
                          Original Message:
                          From: Sean Correia <perl-beginner@yahoogroups.com>
                          Date: Tuesday October 01 2002 01:56PM PT

                          SC> Imagine what some people's bosses would think if they found out their
                          SC> 'programmers' were asking questions about stuff they should already
                          SC> know.

                          SC> It's bullshit that if someone asks a homework related question he gets
                          SC> no answer and hints, but if someone asks a job related question they
                          SC> get whole programs.

                          I would have to agree. It's not the group's role to play God. It's a PERL
                          help list, so let's help.

                          Wherever you go, people are going to succeed and move up the ladder by
                          cheating. So you maybe able to stop it here, but the person will find help
                          elsewhere. You're basically just delaying the inevitable. BTW - I'm
                          saying anyone does this, I'm just saying it's difficult to prevent
                          cheating, and especially over e-mail.

                          I would suggest first, get the person on the right thought process, without
                          necessarily giving out code. If they come back for more help, then help
                          them out with specific code.

                          It's certainly not our job to chose who/how/when we help. The help should
                          be unbiased.

                          -MikeD
                        • jake@thegoop.com
                          I completely agree Jenda. You need to not look only for a straight answer, but instead take the hints, and try to figure out what it means and put them
                          Message 12 of 26 , Oct 1, 2002
                          • 0 Attachment
                            I completely agree Jenda. You need to not look only for a straight answer,
                            but instead take the hints, and try to figure out what it means and put
                            them together with what you already know. Not every program you need will
                            already have the code written in a book, on a website, or taught in
                            class. What WILL be there is techniques to use different things with the
                            code, and it will be up to you to put those together and make the program
                            you need.
                            Any way, my question: Rick, do you know how to add two numbers together in
                            Perl?


                            At 12:16 PM 10/1/2002, you wrote:
                            >From: "RicK" <rik408@...>
                            >
                            > > Know what?
                            > > I think I can do without this group.
                            > > I asked a simple question, and all I got back were condescending and
                            > > patronizing remarks. I thought this was a group for beginning Perl
                            > > programmers, but I see a few big fish living in this little pond.
                            > > Sorry for asking my question. Actually a large part of the class had
                            > > problems with it. We all thought it was a bit much to ask us to do in
                            > > the FIRST week of class. Anyway, thanks for making a newcomer feel so
                            > > "welcome".
                            > >
                            > > Outtie,
                            > > Rick
                            >I'm sorry if you feel offended.
                            >
                            >I really could not believe someone could have problems with this if
                            >he tried.
                            >
                            >If you want to be angry on someone, be angry at your math teacher.
                            >He/She aparently did not do his/her job well.
                            >
                            >In this case instead of telling you to add 5 to the rand(10), we
                            >tried to give you hints. Instead of giving you a fish we all tried to
                            >force you to learn to fish.
                            >
                            >Programming is NOT writing code, programming is solving problems!
                            >You can't expect to find the solution to each and every of your
                            >problems in a book or be taught in lessons. YOU are the one who is
                            >supposed to find solutions. Writing the code is the easy part,
                            >finding the solution, considering all posible cases and errors is the
                            >hard part. But that's what YOU are (will be) there for.
                            >
                            >Jenda
                            >P.S.: As for what this group is for. This group IS for beginning Perl
                            >programmers. It was made to aid in their LEARNING.
                            >It's up to you if you stay, but be prepared to get hints instead of
                            >solutions. And be prepared to look stupid from time to time. We all
                            >use(d) to.
                            >== Jenda@... == <http://Jenda.Krynicky.cz>http://Jenda.Krynicky.cz ==
                            >I wonder why the whole chemistry industry ignores
                            >computer bugs. We all would gladly pay big bucks
                            >for a functional insecticide.
                            >
                            >
                            >Yahoo! Groups Sponsor
                            >ADVERTISEMENT
                            >
                            >Unsubscribing info is here:
                            ><http://help.yahoo.com/help/us/groups/groups-32.html>http://help.yahoo.com/help/us/groups/groups-32.html
                            >
                            >
                            >Your use of Yahoo! Groups is subject to the
                            ><http://docs.yahoo.com/info/terms/>Yahoo! Terms of Service.



                            [Non-text portions of this message have been removed]
                          • jake@thegoop.com
                            ... i never was playing God, and i dont think anyone else was trying to. We were just tryin to give the person (Rick) a learning experience, so he (I m
                            Message 13 of 26 , Oct 1, 2002
                            • 0 Attachment
                              At 02:42 PM 10/1/2002, you wrote:
                              >Original Message:
                              >From: Sean Correia <perl-beginner@yahoogroups.com>
                              >Date: Tuesday October 01 2002 01:56PM PT
                              >
                              >SC> Imagine what some people's bosses would think if they found out their
                              >SC> 'programmers' were asking questions about stuff they should already
                              >SC> know.
                              >
                              >SC> It's bullshit that if someone asks a homework related question he gets
                              >SC> no answer and hints, but if someone asks a job related question they
                              >SC> get whole programs.
                              >
                              >I would have to agree. It's not the group's role to play God. It's a PERL
                              >help list, so let's help.

                              i never was playing God, and i dont think anyone else was trying to. We
                              were just tryin to give the person (Rick) a learning experience, so he (I'm
                              assuming he) gets more self satisfaction from figuring it out more or less
                              himself, rather than just bein told the code with no explanation or anythin
                              really.


                              >Wherever you go, people are going to succeed and move up the ladder by
                              >cheating. So you maybe able to stop it here, but the person will find help
                              >elsewhere. You're basically just delaying the inevitable. BTW - I'm
                              >saying anyone does this, I'm just saying it's difficult to prevent
                              >cheating, and especially over e-mail.
                              >
                              >I would suggest first, get the person on the right thought process, without
                              >necessarily giving out code. If they come back for more help, then help
                              >them out with specific code.

                              Again, what i was doing, maybe a little slow tho...also what the others
                              where doin.


                              >It's certainly not our job to chose who/how/when we help. The help should
                              >be unbiased.
                              >
                              >-MikeD
                              >
                              >
                              >
                              >Yahoo! Groups Sponsor
                              >ADVERTISEMENT
                              >
                              >Unsubscribing info is here:
                              ><http://help.yahoo.com/help/us/groups/groups-32.html>http://help.yahoo.com/help/us/groups/groups-32.html
                              >
                              >
                              >Your use of Yahoo! Groups is subject to the
                              ><http://docs.yahoo.com/info/terms/>Yahoo! Terms of Service.



                              [Non-text portions of this message have been removed]
                            Your message has been successfully submitted and would be delivered to recipients shortly.