Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • World
  • Users
  • Groups
Skins
  • Light
  • Cerulean
  • Cosmo
  • Flatly
  • Journal
  • Litera
  • Lumen
  • Lux
  • Materia
  • Minty
  • Morph
  • Pulse
  • Sandstone
  • Simplex
  • Sketchy
  • Spacelab
  • United
  • Yeti
  • Zephyr
  • Dark
  • Cyborg
  • Darkly
  • Quartz
  • Slate
  • Solar
  • Superhero
  • Vapor

  • Default (No Skin)
  • No Skin
Collapse
Code Project
  1. Home
  2. The Lounge
  3. Rnd() values are changing everytime in ASP.NET

Rnd() values are changing everytime in ASP.NET

Scheduled Pinned Locked Moved The Lounge
csharpc++htmlasp-netcom
35 Posts 27 Posters 0 Views 1 Watching
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • C Chris Maunder

    Rnd() values are changing everytime in ASP.NET[^] The mind. It boggles.

    cheers, Chris Maunder

    CodeProject.com : C++ MVP

    L Offline
    L Offline
    Lost User
    wrote on last edited by
    #20

    Chris, I think the guy wants to return the same value each time Rnd() is called based on a constant seed. The answer to his question is inside the Microsoft documentation[^]. Rnd[(number)] [If number is] Less than zero: The same number every time, using number as the seed. Best Wishes, -David Delaune

    C 1 Reply Last reply
    0
    • J James Brown

      only Chuck Norris can divide by zero


      http://www.catch22.net

      A Offline
      A Offline
      Asday
      wrote on last edited by
      #21

      Only because he's the only one strong enough to roundhouse maths back into existence. Time sees that, and gets scared, then goes to live with some relatives out in California, where it lives as Prince.

      1 Reply Last reply
      0
      • C Chris Maunder

        Rnd() values are changing everytime in ASP.NET[^] The mind. It boggles.

        cheers, Chris Maunder

        CodeProject.com : C++ MVP

        L Offline
        L Offline
        Lost User
        wrote on last edited by
        #22

        Cool, use it to update his password after every login.

        Visit http://www.notreadytogiveup.com/[^] and do something special today.

        1 Reply Last reply
        0
        • Y yassir hannoun

          CAReed wrote:

          This is too funny. It's almost worth the price of admission to Experts Exchange to see the responses.

          if someone has a membership please tell us what is the response !

          D Offline
          D Offline
          Drozzy
          wrote on last edited by
          #23

          You've got to be kidding me right???

          Y 1 Reply Last reply
          0
          • D Drozzy

            You've got to be kidding me right???

            Y Offline
            Y Offline
            yassir hannoun
            wrote on last edited by
            #24

            ;)

            1 Reply Last reply
            0
            • C Chris Maunder

              Rnd() values are changing everytime in ASP.NET[^] The mind. It boggles.

              cheers, Chris Maunder

              CodeProject.com : C++ MVP

              T Offline
              T Offline
              Tomz_KV
              wrote on last edited by
              #25

              Anyone could ask a question like that.

              TOMZ_KV

              1 Reply Last reply
              0
              • J James Brown

                only Chuck Norris can divide by zero


                http://www.catch22.net

                A Offline
                A Offline
                ARon_
                wrote on last edited by
                #26

                And he has counted to infinity - twice. :laugh:

                ARon

                1 Reply Last reply
                0
                • C CAReed

                  As a former programmer of random number generators, I would have to believe that this person has no understanding of one. Yes, he may be wanting to use a seed to generate the same sequence, but since he's not using one means that he doesn't how to use one. This is too funny. It's almost worth the price of admission to Experts Exchange to see the responses.

                  Christopher Reed "The oxen are slow, but the earth is patient."

                  F Offline
                  F Offline
                  Fahad Sadah
                  wrote on last edited by
                  #27

                  CAReed wrote:

                  This is too funny. It's almost worth the price of admission to Experts Exchange to see the responses.

                  Become an expert, and see them for free.

                  1 Reply Last reply
                  0
                  • C Chris Maunder

                    Rnd() values are changing everytime in ASP.NET[^] The mind. It boggles.

                    cheers, Chris Maunder

                    CodeProject.com : C++ MVP

                    F Offline
                    F Offline
                    Fahad Sadah
                    wrote on last edited by
                    #28

                    The idiot wrote:

                    IntTemp = Int((255 * Rnd()) + 1)

                    A response was:

                    change the 255 to a 0 and you'll get the same number each time.

                    1 Reply Last reply
                    0
                    • A Asday

                      If you divide by zero, you actually break time.

                      C Offline
                      C Offline
                      cpkilekofp
                      wrote on last edited by
                      #29

                      Asday wrote:

                      If you divide by zero, you actually break time.

                      Better than breaking wind, I suppose...though, as Shrek always says, "Bettah in than out, I always say!"

                      1 Reply Last reply
                      0
                      • C CAReed

                        As a former programmer of random number generators, I would have to believe that this person has no understanding of one. Yes, he may be wanting to use a seed to generate the same sequence, but since he's not using one means that he doesn't how to use one. This is too funny. It's almost worth the price of admission to Experts Exchange to see the responses.

                        Christopher Reed "The oxen are slow, but the earth is patient."

                        C Offline
                        C Offline
                        cpkilekofp
                        wrote on last edited by
                        #30

                        CAReed wrote:

                        This is too funny. It's almost worth the price of admission to Experts Exchange to see the responses.

                        My price of admission is zero - I answer questions there.

                        1 Reply Last reply
                        0
                        • C Chris Maunder

                          Rnd() values are changing everytime in ASP.NET[^] The mind. It boggles.

                          cheers, Chris Maunder

                          CodeProject.com : C++ MVP

                          R Offline
                          R Offline
                          Richard Jones
                          wrote on last edited by
                          #31

                          While I agree OP was probably asking for a seed method, I like this answer:

                          Try this function

                          Function UnRnd()
                          UnRnd = 4 'my favourite number!
                          End Function

                          IntTemp = Int((255 * UnRnd()) + 1)

                          Cheetah. Ferret. Gonads. What more can I say? - Pete O'Hanlon

                          1 Reply Last reply
                          0
                          • L Lost User

                            Chris, I think the guy wants to return the same value each time Rnd() is called based on a constant seed. The answer to his question is inside the Microsoft documentation[^]. Rnd[(number)] [If number is] Less than zero: The same number every time, using number as the seed. Best Wishes, -David Delaune

                            C Offline
                            C Offline
                            cpkilekofp
                            wrote on last edited by
                            #32

                            Randor wrote:

                            I think the guy wants to return the same value each time Rnd() is called based on a constant seed. The answer to his question is inside the Microsoft documentation[^].

                            It's also the answer that got the points in the Experts Exchange thread.

                            1 Reply Last reply
                            0
                            • J Johnno74

                              Pro tip - you can use the google cache to get the answers. If you hit an experts exchange result in google, click on "cached" to view the cached copy from google, which will include the answers. Lately they added some CSS to the page to hide these, but if you click on the "text only" link then you can find all the answers . Direct link to the answers for that question: http://209.85.173.132/search?q=cache:WxyHTS7gXW4J:www.experts-exchange.com/Web_Development/Miscellaneous/Q_22031739.html+http://www.experts-exchange.com/Web_Development/Miscellaneous/Q_22031739.html&hl=en&client=firefox-a&gl=au&strip=1[^] God I hate experts exchange.

                              I Offline
                              I Offline
                              Idan Shimoni
                              wrote on last edited by
                              #33

                              Thanks, that is a really good tip, I really hate them too God I Love "The Code Project" :-)

                              1 Reply Last reply
                              0
                              • A Allan Thomas

                                You could just open the page and scroll all the way to the bottom. For some reason the always leave the answers down the bottom so I don't have to pay a cent :laugh: .

                                K Offline
                                K Offline
                                Ken Hadden
                                wrote on last edited by
                                #34

                                I bet they contracted that sight out to open source developers. <-- think about that. Who "accidentally" allowed the answers to show at the bottom. They probably guessed that the executive who paid them would never take the time to scroll all the way down. I'm thinking they guessed right.

                                Thanks. KHadden

                                1 Reply Last reply
                                0
                                • J Johnno74

                                  Pro tip - you can use the google cache to get the answers. If you hit an experts exchange result in google, click on "cached" to view the cached copy from google, which will include the answers. Lately they added some CSS to the page to hide these, but if you click on the "text only" link then you can find all the answers . Direct link to the answers for that question: http://209.85.173.132/search?q=cache:WxyHTS7gXW4J:www.experts-exchange.com/Web_Development/Miscellaneous/Q_22031739.html+http://www.experts-exchange.com/Web_Development/Miscellaneous/Q_22031739.html&hl=en&client=firefox-a&gl=au&strip=1[^] God I hate experts exchange.

                                  M Offline
                                  M Offline
                                  Mike Holpuch
                                  wrote on last edited by
                                  #35

                                  Don't you all know we're suppose to keep this on the DL? :laugh: The last thing we want is to have EE actually start hiding their answers. Although, I suppose some of you are correct in that they keep the answers there so that search engines can read them.

                                  1 Reply Last reply
                                  0
                                  Reply
                                  • Reply as topic
                                  Log in to reply
                                  • Oldest to Newest
                                  • Newest to Oldest
                                  • Most Votes


                                  • Login

                                  • Don't have an account? Register

                                  • Login or register to search.
                                  • First post
                                    Last post
                                  0
                                  • Categories
                                  • Recent
                                  • Tags
                                  • Popular
                                  • World
                                  • Users
                                  • Groups