none
interesting oddity with system.random utilization RRS feed

  • General discussion

  • hi, I've been utilizing the pseudo random number generator provided by system.random, and interestingly, and I utilize the code vara.next(1, 10000001), and repeat this code every one second, to get a number between 1 and ten million, I never get any numbers lower than 100,000.  This is really weird, ne ideas?  Does the prng spaz out with a value that high, or are we looking at a 'magical', or perhaps non-physical explanation here.....  I know that idea may blow your mind, but we do live in an age where consciousness is seen as a permeating force more and more in psychology and metaphysics.....
    • Changed type Tess Card Thursday, May 24, 2012 8:22 PM open-ended discussion
    Thursday, May 24, 2012 7:29 PM

All replies

  • Given x between 1 and 10million, what is the probability of x being less than 100000? Have you sampled enough to ensure that you are likely to get one?

    PS I avoid talk of such incoherent ideas as 'consciousness as an object or force'. :) But that's philosophy not VB.


    Regards David R
    ---------------------------------------------------------------
    The great thing about Object Oriented code is that it can make small, simple problems look like large, complex ones.
    Object-oriented programming offers a sustainable way to write spaghetti code. - Paul Graham.
    Every program eventually becomes rococo, and then rubble. - Alan Perlis
    The only valid measurement of code quality: WTFs/minute.

    Thursday, May 24, 2012 7:38 PM
  • It's all about probability: the chance of getting a number below 100,000 when you select a number between 1 and 10,000,001 is about 1%. So with a 1% probability (1/100) there is about a 36% chance you will not see such a number in 100 'tries'.

    In other words, keep sampling: you are sampling every 1 second, so it may be a minute or two (or never!) before you see a number you are looking for.


    Stephen J Whiteley

    Thursday, May 24, 2012 7:44 PM
    Moderator
  • Can you please supply your code (metaphysical or not)?  I ran the following and got numbers below 100000 within 10 seconds.
     

        Sub Main()
            Dim r As New Random
            While (True)
                Console.WriteLine(r.Next(1, 10000001))
     
                Threading.Thread.Sleep(1000)
            End While
        End Sub

    --
    Mike
    Thursday, May 24, 2012 7:45 PM
  • Imports System.Threading
    Imports System.Random
    Imports System.IO

    Public Class Form1

        Dim threada As New Thread(AddressOf thread_A)
        Dim log1 As StreamWriter
        Dim vara
        Dim varb As New Random
        Dim varc = 0

        Public Sub thread_A()

    1:      vara = varb.Next(1, 10000001)

            varc = varc + 1

            Dim textBoxInstance As TextBox = CType(Controls.Item("TextBox" & varc.ToString), TextBox)

            textBoxInstance.Text = (vara & " ")

            log1.WriteLine(vara & Microsoft.VisualBasic.vbCrLf)

            'GoTo 2

            Thread.Sleep(200)

            Thread.Sleep(1000)

    2:      'Thread.Sleep(20)

            If varc < 27 Then GoTo 1

    3:      varc = 1

            GoTo 5

    4:      varc = varc + 1

    5:      Dim textBoxInstance2 As TextBox = CType(Controls.Item("TextBox" & varc.ToString), TextBox)

            textBoxInstance2.Text = Nothing

            If varc < 27 Then GoTo 4

    6:      varc = 0

    7:      GoTo 1

        End Sub

        Private Sub Button1_Click(sender As System.Object, e As System.EventArgs) Handles Button1.Click

            threada.Start()

        End Sub

        Private Sub Form1_Load(sender As Object, e As System.EventArgs) Handles Me.Load

            log1 = New StreamWriter("C:\Users\jetramantozz2\Desktop\log1file.txt")

            Form1.CheckForIllegalCrossThreadCalls = False

        End Sub

        Private Sub Button3_Click(sender As System.Object, e As System.EventArgs) Handles Button3.Click

            log1.Close()

            End

        End Sub

    End Class

    • Edited by Tess Card Thursday, May 24, 2012 8:08 PM
    Thursday, May 24, 2012 7:59 PM
  • I ran this and got probabilities round the 0.01 (1%) mark - did about 10 runs and none looked significantly different.

    using System;

    namespace ConsoleApplication1
    {

       class Program
       {
          static void Main(string[] args)
          {
             const int TEN_MILL = 10000000;
             const int HUN_THOUS = 100000;
             Random generator = new Random();
             int x = 0;
             for (int i = 0; i < TEN_MILL; i++)
             {
                int y = generator.Next(1, TEN_MILL+1);
                if (y <= HUN_THOUS) x++;
             }
             Console.WriteLine("Less than " + HUN_THOUS + " = " + x.ToString());
             Console.WriteLine("Probability = " + ((Double)x / TEN_MILL).ToString());
             Console.ReadLine();
          }
       }
    }


    Regards David R
    ---------------------------------------------------------------
    The great thing about Object Oriented code is that it can make small, simple problems look like large, complex ones.
    Object-oriented programming offers a sustainable way to write spaghetti code. - Paul Graham.
    Every program eventually becomes rococo, and then rubble. - Alan Perlis
    The only valid measurement of code quality: WTFs/minute.

    Thursday, May 24, 2012 8:00 PM
  • Basically, the main reason why I bring up a possible consciousness effect is because I became learned in Noetic Magic, or consciousness as a intermediary force that permeates reality....  I designed the program listed above to sort of run a simulation on low energy-input energy extraction from Mars, and one of the magical variables that I do not necessarily control is the contested nature of the planet....  I was thinking that perhaps the prng is displaying anomalous behavior due to the fact that in this magical simulation, the planet is contested, and therefore, the number ten million, which represents the total surface area of the planet, is not totally accessible..... edited


    • Edited by Tess Card Thursday, May 24, 2012 8:24 PM
    Thursday, May 24, 2012 8:13 PM
  • Sorry, but I got a value of 5527 in the third textbox when running your code.  Other runs can take longer, but you will see values < 100000 about 1% of the time.  The expected distance to see a value less than 100000 would be every 100 seconds.

    --
    Mike
    Thursday, May 24, 2012 8:19 PM
  • Deleted
    Thursday, May 24, 2012 8:20 PM
  • That's fine, I'm glad the code works normally for other people.....  I would have been peeved if it didn't.... ne ways, see my edited post for a more detailed version of the story that explains why I believe it's being finicky with me. btw, I've run this code for days, addings up to many hours, and haven't received a value lower than 100,000....
    • Edited by Tess Card Thursday, May 24, 2012 8:53 PM
    Thursday, May 24, 2012 8:21 PM
  • Bizarre. How can you say that your implementation indicates anything to do with Mars.What's with mysterious 'energy' as opposed to plain old fashioned energy? It's up there with Aristotelian 'elements' and quintessences.

    I think it's the gremlins, or poor programming - it fails to compile with Option Strict On. And as for the splattering of goto's. I thought they were dead and buried along with other spaghetti techniques. LOL.


    Regards David R
    ---------------------------------------------------------------
    The great thing about Object Oriented code is that it can make small, simple problems look like large, complex ones.
    Object-oriented programming offers a sustainable way to write spaghetti code. - Paul Graham.
    Every program eventually becomes rococo, and then rubble. - Alan Perlis
    The only valid measurement of code quality: WTFs/minute.

    Thursday, May 24, 2012 8:24 PM
  • going to ignore your comment Riced except for the goto part, made me laugh rofl.... btw vb .net ftw, why'd you post code in c#?
    • Edited by Tess Card Thursday, May 24, 2012 8:31 PM
    Thursday, May 24, 2012 8:27 PM
  • Aw shucks. I'd thought you might have a go at defending the indefensible.

    BTW what are you units for surface of Mars (I thought it about 145million sq. kilometers)?

    Here's a project you might try with rn's - if you can consciously influence them why not do that with the national lottery machine and generate a winning combination?


    Regards David R
    ---------------------------------------------------------------
    The great thing about Object Oriented code is that it can make small, simple problems look like large, complex ones.
    Object-oriented programming offers a sustainable way to write spaghetti code. - Paul Graham.
    Every program eventually becomes rococo, and then rubble. - Alan Perlis
    The only valid measurement of code quality: WTFs/minute.

    Thursday, May 24, 2012 8:34 PM
  • My bias???  I am not sure I know what I wrote to offend you, but sorry...

    --
    Mike
    Thursday, May 24, 2012 8:38 PM
  • Not you Mike, sorry, I didn't post the reply directly to the person that was moderately offensive.... I deleted that reply and reposted it where it should be..
    • Edited by Tess Card Thursday, May 24, 2012 8:51 PM
    Thursday, May 24, 2012 8:50 PM
  • Your statement is extremely biased, as you have no knowledge of anything I'm talking about except maybe subconsciously, although I'm glad that your energy is balancing this thread.....
    Thursday, May 24, 2012 8:51 PM
  • I posted in C# because I thought the languages needed balancing in this thread.

    Also, and more mundanely, it makes no difference since both languages use the same Random class and I happened to have C# open but not VB.


    Regards David R
    ---------------------------------------------------------------
    The great thing about Object Oriented code is that it can make small, simple problems look like large, complex ones.
    Object-oriented programming offers a sustainable way to write spaghetti code. - Paul Graham.
    Every program eventually becomes rococo, and then rubble. - Alan Perlis
    The only valid measurement of code quality: WTFs/minute.

    Thursday, May 24, 2012 8:56 PM
  • HaHaHa

    The Brain do work on an atomic level, mostly thru ion process.

    Therefore, it follows the rules of the Quantum theory and for anyone that have a minimum knowledge of this, there is only two possibility:

      1) your consciousness exists only in the brain

      2) your consciousness exists anywhere in the univers

    It would depend on what exactly creates the consciousness.

    If the consciousness exists anywhere in the univers, then it is idiot to say that Mars can influence more than any other planet in the univers

    If the consciousness exists only in the brain, therefore, we are only a simple chemical reaction, and we wont take anything with us when we will pass away, so, why bother about the illogical possibility of your science??

    Also, when such science brings parameters that are base on human perseption (Like the quantified value of the surface of an object),  instead of parameters that are not relativism, then the only conclusion possible is that such science is bull sh__t



    Thursday, May 24, 2012 9:17 PM
  • touché.. wonderful points
    • Edited by Tess Card Thursday, May 24, 2012 9:50 PM
    Thursday, May 24, 2012 9:49 PM
  • Crazypennie

    Hmm, I thought QM indicates that it does not exist in an either/or sense but rather a state of superposition. At least until it is observed. Mind that assumes consciousness exists as some sort of object or force. And that I find somewhat implausible.

    Interesting take on science - IIUC you say if it is based on perception then it is bull. That just about rules out all science which is concerned with making measurements.

    Mind I am confused about whether you are arguing in support of or against jetramantozz2's rather quaint ideas. He/she/it (delete as seems appropriate) seems to approve, or is being ironic in reply.


    Regards David R
    ---------------------------------------------------------------
    The great thing about Object Oriented code is that it can make small, simple problems look like large, complex ones.
    Object-oriented programming offers a sustainable way to write spaghetti code. - Paul Graham.
    Every program eventually becomes rococo, and then rubble. - Alan Perlis
    The only valid measurement of code quality: WTFs/minute.

    Thursday, May 24, 2012 10:36 PM
  • Deleted
    Friday, May 25, 2012 1:25 AM
  • In the sciences, like Phisics, Chemistry, etc ... the mesurements are done as a proof of what was found from the tools that we have to handle the logic. One of the better tool we have to handle the logic is probably the math.

    However, the rules that we established in  any natural science (Physics, chemistry, etc) , are so that they would exists as they are even without the existance of the human being.

    You can think as a planet as being a big object, but is it realy big, it is not even the size of a dust on earth compared to the univers. you can think as earth as a compact object, but remove all the empty space between the atoms and it will fit in less of a cubic inch. Our perseption of a solid object is not the material it contains, because there is almost none, it is the forces that exists between these little pieces of material.

    And if you know about quantum physics, you also know that these little piece of material don't actualy exists at a definite location. All we can tell about the location of an electron or any particule is a probability of finding it at a specific location at a specific time. However, that electron also have a probability of being anywere in the univers at that same exact time. May be hard for a human brain to visualize this, however there is so many proof if this that we got to accept it. (Being false, your computer wouldn't work).

    Mesurement done to proof or disproof the result a of logic idea is not the same as using a mesurement to create an idea that has no logic attached to it.

    Just as: an object does have an area even without human being. but the actual value given to this object in square feet or square meters is only an artifice given to the surface of the object for the brain to be able to understand. This value has no meaning by itself, this value wouldn't exist without the human being as observator.

    I sure do not supports the science that the OP is talking about. And I do not do that base on the perseption I have of it, (Otherwise I would have to reject the Quantum theory also since no human perseption will lead to believe in it). I reject it because this science is only base on perseption and interpretation of those perseption.


    Friday, May 25, 2012 1:38 AM
  • Basically, the main reason why I bring up a possible consciousness effect is because I became learned in Noetic Magic, or consciousness as a intermediary force that permeates reality....  I designed the program listed above to sort of run a simulation on low energy-input energy extraction from Mars, and one of the magical variables that I do not necessarily control is the contested nature of the planet....  I was thinking that perhaps the prng is displaying anomalous behavior due to the fact that in this magical simulation, the planet is contested, and therefore, the number ten million, which represents the total surface area of the planet, is not totally accessible..... edited


    Does this remind anyone else of this (console app):

    Module Module1
    
        Sub Main()
          Dim data() As Byte = {77, 84, 104, 100, 0, 0, 0, 6, 0, 1, 0, 18, 1, 128, 77, 84, 114, 107, 0, 0, 0, 106, 0, 255, 127, 11, 5, 15, 18, 3, 3, 127, 127, 0, 255, 1, 4, 0, 255, 127, 15, 5, 15, 28, 50, 48, 49, 50, 46, 48, 53, 46, 49, 48, 1, 3, 0, 255, 127, 42, 5, 15, 45, 77, 105, 99, 114, 111, 115, 111, 102, 116, 32, 83, 97, 110, 115, 32, 83, 101, 114, 105, 102, 44, 56, 46, 50, 53, 44, 70, 97, 108, 115, 101, 44, 70, 97, 108, 115, 101, 44, 49, 0, 255, 88, 4, 4, 2, 96, 8, 0, 255, 127, 3, 0, 0, 65, 0, 255, 81, 3, 6, 239, 145, 0, 255, 47, 0, 77, 84, 114, 107, 0, 0, 0, 64, 0, 255, 127, 5, 5, 15, 9, 12, 64, 0, 255, 127, 15, 5, 15, 6, 71, 101, 110, 101, 114, 97, 108, 32, 77, 73, 68, 73, 0, 255, 3, 9, 66, 114, 97, 115, 115, 83, 101, 99, 116, 0, 176, 0, 0, 0, 192, 61, 0, 176, 10, 35, 164, 0, 255, 127, 3, 5, 15, 10, 0, 255, 47, 0, 77, 84, 114, 107, 0, 0, 0, 64, 0, 255, 127, 5, 5, 15, 9, 12, 64, 0, 255, 127, 15, 5, 15, 6, 71, 101, 110, 101, 114, 97, 108, 32, 77, 73, 68, 73, 0, 255, 3, 9, 66, 114, 105, 103, 104, 116, 32, 70, 88, 0, 177, 0, 0, 0, 193, 100, 0, 177, 10, 31, 164, 0, 255, 127, 3, 5, 15, 10, 0, 255, 47, 0, 77, 84, 114, 107, 0, 0, 2, 98, 0, 255, 127, 5, 5, 15, 9, 12, 64, 0, 255, 127, 15, 5, 15, 6, 71, 101, 110, 101, 114, 97, 108, 32, 77, 73, 68, 73, 0, 255, 3, 8, 71, 116, 114, 78, 121, 108, 111, 110, 0, 178, 0, 0, 0, 194, 24, 0, 178, 10, 97, 0, 146, 58, 93, 0, 146, 57, 93, 129, 0, 130, 58, 93, 0, 130, 57, 93, 64, 146, 58, 93, 0, 146, 56, 93, 129, 0, 130, 58, 93, 0, 130, 56, 93, 64, 146, 58, 93, 0, 146, 52, 93, 129, 0, 130, 58, 93, 0, 130, 52, 93, 64, 146, 58, 93, 0, 146, 56, 93, 129, 0, 130, 58, 93, 0, 130, 56, 93, 64, 146, 58, 93, 0, 146, 57, 93, 129, 0, 130, 58, 93, 0, 130, 57, 93, 64, 146, 58, 93, 0, 146, 56, 93, 129, 0, 130, 58, 93, 0, 130, 56, 93, 64, 146, 58, 93, 0, 146, 52, 93, 129, 0, 130, 58, 93, 0, 130, 52, 93, 64, 146, 58, 93, 0, 146, 56, 93, 129, 0, 130, 58, 93, 0, 130, 56, 93, 64, 146, 58, 93, 0, 146, 57, 93, 129, 0, 130, 58, 93, 0, 130, 57, 93, 64, 146, 58, 93, 0, 146, 56, 93, 129, 0, 130, 58, 93, 0, 130, 56, 93, 64, 146, 58, 93, 0, 146, 52, 93, 129, 0, 130, 58, 93, 0, 130, 52, 93, 64, 146, 58, 93, 0, 146, 56, 93, 129, 0, 130, 58, 93, 0, 130, 56, 93, 64, 146, 58, 93, 0, 146, 57, 93, 129, 0, 130, 58, 93, 0, 130, 57, 93, 64, 146, 58, 93, 0, 146, 56, 93, 129, 0, 130, 58, 93, 0, 130, 56, 93, 64, 146, 58, 93, 0, 146, 52, 93, 129, 0, 130, 58, 93, 0, 130, 52, 93, 64, 146, 58, 93, 0, 146, 56, 93, 129, 0, 130, 58, 93, 0, 130, 56, 93, 64, 178, 10, 97, 0, 146, 58, 93, 0, 146, 57, 93, 129, 0, 130, 58, 93, 0, 130, 57, 93, 64, 146, 58, 93, 0, 146, 56, 93, 129, 0, 130, 58, 93, 0, 130, 56, 93, 64, 146, 58, 93, 0, 146, 52, 93, 129, 0, 130, 58, 93, 0, 130, 52, 93, 64, 146, 58, 93, 0, 146, 56, 93, 129, 0, 130, 58, 93, 0, 130, 56, 93, 64, 146, 58, 93, 0, 146, 57, 93, 129, 0, 130, 58, 93, 0, 130, 57, 93, 64, 146, 58, 93, 0, 146, 56, 93, 129, 0, 130, 58, 93, 0, 130, 56, 93, 64, 146, 58, 93, 0, 146, 52, 93, 129, 0, 130, 58, 93, 0, 130, 52, 93, 64, 146, 58, 93, 0, 146, 56, 93, 129, 0, 130, 58, 93, 0, 130, 56, 93, 64, 146, 58, 93, 0, 146, 57, 93, 129, 0, 130, 58, 93, 0, 130, 57, 93, 64, 146, 58, 93, 0, 146, 56, 93, 129, 0, 130, 58, 93, 0, 130, 56, 93, 64, 146, 58, 93, 0, 146, 52, 93, 129, 0, 130, 58, 93, 0, 130, 52, 93, 64, 146, 58, 93, 0, 146, 56, 93, 129, 0, 130, 58, 93, 0, 130, 56, 93, 64, 146, 58, 93, 0, 146, 57, 93, 129, 0, 130, 58, 93, 0, 130, 57, 93, 64, 146, 58, 93, 0, 146, 56, 93, 129, 0, 130, 58, 93, 0, 130, 56, 93, 64, 146, 58, 93, 0, 146, 52, 93, 129, 0, 130, 58, 93, 0, 130, 52, 93, 64, 146, 58, 93, 0, 146, 56, 93, 129, 0, 130, 58, 93, 0, 130, 56, 93, 64, 255, 127, 3, 5, 15, 10, 0, 255, 47, 0, 77, 84, 114, 107, 0, 0, 2, 98, 0, 255, 127, 5, 5, 15, 9, 76, 72, 0, 255, 127, 15, 5, 15, 6, 71, 101, 110, 101, 114, 97, 108, 32, 77, 73, 68, 73, 0, 255, 3, 8, 71, 116, 114, 83, 116, 101, 101, 108, 0, 179, 0, 0, 0, 195, 25, 0, 179, 10, 84, 0, 147, 58, 112, 0, 147, 57, 112, 129, 0, 131, 58, 112, 0, 131, 57, 112, 64, 147, 58, 112, 0, 147, 56, 112, 129, 0, 131, 58, 112, 0, 131, 56, 112, 64, 147, 58, 112, 0, 147, 52, 112, 129, 0, 131, 58, 112, 0, 131, 52, 112, 64, 147, 58, 112, 0, 147, 56, 112, 129, 0, 131, 58, 112, 0, 131, 56, 112, 64, 147, 58, 112, 0, 147, 57, 112, 129, 0, 131, 58, 112, 0, 131, 57, 112, 64, 147, 58, 112, 0, 147, 56, 112, 129, 0, 131, 58, 112, 0, 131, 56, 112, 64, 147, 58, 112, 0, 147, 52, 112, 129, 0, 131, 58, 112, 0, 131, 52, 112, 64, 147, 58, 112, 0, 147, 56, 112, 129, 0, 131, 58, 112, 0, 131, 56, 112, 64, 147, 58, 112, 0, 147, 57, 112, 129, 0, 131, 58, 112, 0, 131, 57, 112, 64, 147, 58, 112, 0, 147, 56, 112, 129, 0, 131, 58, 112, 0, 131, 56, 112, 64, 147, 58, 112, 0, 147, 52, 112, 129, 0, 131, 58, 112, 0, 131, 52, 112, 64, 147, 58, 112, 0, 147, 56, 112, 129, 0, 131, 58, 112, 0, 131, 56, 112, 64, 147, 58, 112, 0, 147, 57, 112, 129, 0, 131, 58, 112, 0, 131, 57, 112, 64, 147, 58, 112, 0, 147, 56, 112, 129, 0, 131, 58, 112, 0, 131, 56, 112, 64, 147, 58, 112, 0, 147, 52, 112, 129, 0, 131, 58, 112, 0, 131, 52, 112, 64, 147, 58, 112, 0, 147, 56, 112, 129, 0, 131, 58, 112, 0, 131, 56, 112, 64, 179, 10, 84, 0, 147, 58, 112, 0, 147, 57, 112, 129, 0, 131, 58, 112, 0, 131, 57, 112, 64, 147, 58, 112, 0, 147, 56, 112, 129, 0, 131, 58, 112, 0, 131, 56, 112, 64, 147, 58, 112, 0, 147, 52, 112, 129, 0, 131, 58, 112, 0, 131, 52, 112, 64, 147, 58, 112, 0, 147, 56, 112, 129, 0, 131, 58, 112, 0, 131, 56, 112, 64, 147, 58, 112, 0, 147, 57, 112, 129, 0, 131, 58, 112, 0, 131, 57, 112, 64, 147, 58, 112, 0, 147, 56, 112, 129, 0, 131, 58, 112, 0, 131, 56, 112, 64, 147, 58, 112, 0, 147, 52, 112, 129, 0, 131, 58, 112, 0, 131, 52, 112, 64, 147, 58, 112, 0, 147, 56, 112, 129, 0, 131, 58, 112, 0, 131, 56, 112, 64, 147, 58, 112, 0, 147, 57, 112, 129, 0, 131, 58, 112, 0, 131, 57, 112, 64, 147, 58, 112, 0, 147, 56, 112, 129, 0, 131, 58, 112, 0, 131, 56, 112, 64, 147, 58, 112, 0, 147, 52, 112, 129, 0, 131, 58, 112, 0, 131, 52, 112, 64, 147, 58, 112, 0, 147, 56, 112, 129, 0, 131, 58, 112, 0, 131, 56, 112, 64, 147, 58, 112, 0, 147, 57, 112, 129, 0, 131, 58, 112, 0, 131, 57, 112, 64, 147, 58, 112, 0, 147, 56, 112, 129, 0, 131, 58, 112, 0, 131, 56, 112, 64, 147, 58, 112, 0, 147, 52, 112, 129, 0, 131, 58, 112, 0, 131, 52, 112, 64, 147, 58, 112, 0, 147, 56, 112, 129, 0, 131, 58, 112, 0, 131, 56, 112, 64, 255, 127, 3, 5, 15, 10, 0, 255, 47, 0, 77, 84, 114, 107, 0, 0, 0, 32, 0, 255, 127, 5, 5, 15, 9, 12, 64, 0, 255, 127, 15, 5, 15, 6, 71, 101, 110, 101, 114, 97, 108, 32, 77, 73, 68, 73, 0, 255, 47, 0, 77, 84, 114, 107, 0, 0, 0, 32, 0, 255, 127, 5, 5, 15, 9, 12, 64, 0, 255, 127, 15, 5, 15, 6, 71, 101, 110, 101, 114, 97, 108, 32, 77, 73, 68, 73, 0, 255, 47, 0, 77, 84, 114, 107, 0, 0, 0, 32, 0, 255, 127, 5, 5, 15, 9, 12, 64, 0, 255, 127, 15, 5, 15, 6, 71, 101, 110, 101, 114, 97, 108, 32, 77, 73, 68, 73, 0, 255, 47, 0, 77, 84, 114, 107, 0, 0, 0, 32, 0, 255, 127, 5, 5, 15, 9, 12, 64, 0, 255, 127, 15, 5, 15, 6, 71, 101, 110, 101, 114, 97, 108, 32, 77, 73, 68, 73, 0, 255, 47, 0, 77, 84, 114, 107, 0, 0, 0, 32, 0, 255, 127, 5, 5, 15, 9, 12, 64, 0, 255, 127, 15, 5, 15, 6, 71, 101, 110, 101, 114, 97, 108, 32, 77, 73, 68, 73, 0, 255, 47, 0, 77, 84, 114, 107, 0, 0, 0, 32, 0, 255, 127, 5, 5, 15, 9, 12, 64, 0, 255, 127, 15, 5, 15, 6, 71, 101, 110, 101, 114, 97, 108, 32, 77, 73, 68, 73, 0, 255, 47, 0, 77, 84, 114, 107, 0, 0, 0, 32, 0, 255, 127, 5, 5, 15, 9, 12, 64, 0, 255, 127, 15, 5, 15, 6, 71, 101, 110, 101, 114, 97, 108, 32, 77, 73, 68, 73, 0, 255, 47, 0, 77, 84, 114, 107, 0, 0, 0, 32, 0, 255, 127, 5, 5, 15, 9, 12, 64, 0, 255, 127, 15, 5, 15, 6, 71, 101, 110, 101, 114, 97, 108, 32, 77, 73, 68, 73, 0, 255, 47, 0, 77, 84, 114, 107, 0, 0, 0, 32, 0, 255, 127, 5, 5, 15, 9, 12, 64, 0, 255, 127, 15, 5, 15, 6, 71, 101, 110, 101, 114, 97, 108, 32, 77, 73, 68, 73, 0, 255, 47, 0, 77, 84, 114, 107, 0, 0, 0, 32, 0, 255, 127, 5, 5, 15, 9, 12, 64, 0, 255, 127, 15, 5, 15, 6, 71, 101, 110, 101, 114, 97, 108, 32, 77, 73, 68, 73, 0, 255, 47, 0, 77, 84, 114, 107, 0, 0, 0, 32, 0, 255, 127, 5, 5, 15, 9, 12, 64, 0, 255, 127, 15, 5, 15, 6, 71, 101, 110, 101, 114, 97, 108, 32, 77, 73, 68, 73, 0, 255, 47, 0, 77, 84, 114, 107, 0, 0, 0, 32, 0, 255, 127, 5, 5, 15, 9, 12, 64, 0, 255, 127, 15, 5, 15, 6, 71, 101, 110, 101, 114, 97, 108, 32, 77, 73, 68, 73, 0, 255, 47, 0, 77, 84, 114, 107, 0, 0, 0, 32, 0, 255, 127, 5, 5, 15, 9, 12, 64, 0, 255, 127, 15, 5, 15, 6, 71, 101, 110, 101, 114, 97, 108, 32, 77, 73, 68, 73, 0, 255, 47, 0}
          Dim tempfile As String = IO.Path.GetTempFileName
          Dim fi As New IO.FileInfo(tempfile)
          Dim fs As IO.FileStream = IO.File.Open(tempfile, IO.FileMode.Create, IO.FileAccess.Write)
          Dim bw As New IO.BinaryWriter(fs)
    
          For Each item As Byte In data
             bw.Write(item)
          Next
          bw.Close()
          Dim ret As Int32
          ret = mciSendString(String.Format("open ""{0}"" type sequencer alias MidiFile", tempfile), Nothing, 0, IntPtr.Zero)
          ret = mciSendString("play MidiFile wait", Nothing, 0, IntPtr.Zero)
          ret = mciSendString("close MidiFile", Nothing, 0, IntPtr.Zero)
          IO.File.Delete(tempfile)
        End Sub
    
       <Runtime.InteropServices.DllImport("winmm.dll")> _
       Private Function mciSendString(ByVal command As String, _
                                             ByVal buffer As System.Text.StringBuilder, _
                                             ByVal bufferSize As Int32, _
                                             ByVal hwndCallback As IntPtr) As Int32
       'ref: http://msdn.microsoft.com/en-us/library/windows/desktop/dd757161%28v=vs.85%29.aspx
       End Function
    End Module

    Friday, May 25, 2012 1:40 AM
  •  

    :)

    Friday, May 25, 2012 1:51 AM
  •  Actually if you use fractals to denote the true surface area of the planet it is much greater than the 144,798,500 km squared listed in wikipedia and of course greater than the 100000001 you are using in your code. Apparently your codes anomaly is causing the intermediary forces that permeate your computer to low ball the energy constant of Mars therefore the energy-input energy extraction is not resonating at the metaphysical level you require. A good Toga party can remedy some of that.
    Friday, May 25, 2012 4:16 AM
  • Jordan,

    I agree.

    Renee


    "MODERN PROGRAMMING is deficient in elementary ways BECAUSE of problems INTRODUCED by MODERN PROGRAMMING." Me

    Friday, May 25, 2012 8:22 AM
  • I ran the following code:

    Public Class Form1
        Dim Whacko As New System.Random
        Private Sub Timer1_Tick(sender As System.Object, e As System.EventArgs) Handles Timer1.Tick
            Dim abracadabra As Integer = Whacko.Next(1, 10000001)
            If abracadabra < 100000 Then
                TextBox1.AppendText(abracadabra.ToString("d8") & " - synchronicity" & vbCrLf)
            Else
                TextBox1.AppendText(abracadabra.ToString("d8") & vbCrLf)
            End If
    
    
        End Sub
    
        Private Sub Button1_Click(sender As System.Object, e As System.EventArgs) Handles Button1.Click
            Timer1.Enabled = Not Timer1.Enabled
        End Sub
    End Class

    This gave me approximately 1 percent of synchronous numbers. I also found that staring intensely at the screen or at the mouse made no measureable difference in the numeric distribution.

    Friday, May 25, 2012 2:16 PM
  • Have you checked to voltage at your mains ?

    If the voltage is too high, the computer cannot calculate lower values.

    Friday, May 25, 2012 5:08 PM
  • I would like you to try something. Run the following code a few times:

    Dim MyRand As New Random()
    
    Dim Results As New System.Text.StringBuilder
    
    For i As Integer = 0 To 9
        Results.Append(MyRand.Next(0, 10) & " ")
    Next
    
    MsgBox(Results.ToString)
    
    Me.Close()

    You'll notice the output is different every time. Now, modify the first line and change it to this:

    Dim MyRand As New Random(15)

    Now run that code twice. You'll notice the numbers are the same. Run it again, they will be the same still. Run it a hundred, thousand, or even million times, those numbers will be the same. Go to a different computer and run the same code.. you will get the same results. Change the loop so that it runs ten thousand times instead of 10 times and you will still have the same exact output, every single time you run it.

    The reason is that random numbers aren't truly random in VB.net, or in most PRNGs. A little background on how PRNGs work (forgive me if you already know this.. it seems that you don't when you speak of Mars' energies affecting your results...). A PRNG takes a number and performs mathematical calculations on it to generate a different number. It uses a supplied starting value, or "seed" to start the generator. When the PRNG needs a new number, it takes the last value and performs some more math and gives you the next value.

    In VB.net, when you don't specify a seed value (Dim MyRand as New Random()), VB.net fills one in for you. That is why the numbers "appear" random, because the seed is different, though not truly random. When you supply the seed (Dim MyRand as New Random(15)), however, it becomes clear.. VB.net's PRNG performs the same mathematical calculations on the seed every single time. There are various implications in Cryptography that deal with finding a truly random seed value to make encryption even stronger, and that is an interesting thing to look into.. but not related to your topic.

    The bottom line? The numbers you are generating are not random. Your computer is feeding VB.net's PRNG a different "random" seed value (hence the Psuedo in Psuedo Random Number Generator) and mathematical computations are done on that seed value. It is not random, although it behaves sufficiently randomly for most purposes. If you don't get a certain value, it's because the generator has not performed just the right mathematical operation on the last result, not because of consciousness or energies from Mars.

    Hope that helps.


    Friday, May 25, 2012 5:59 PM