Interesting Oddity With System.random Utilization

May 24, 2012

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.

View 1 Replies


ADVERTISEMENT

Oddity In A MessageBox?

Jun 1, 2012

I have this

Dim st1 As String = sref.ConfirmLogin() 'A WCF method call.
Windows.Forms.MessageBox.Show(st1 & Environment.NewLine & "blue", "Result")

What is interesting about this is that there is no new line in the messagebox, and "blue" doesn't show up. If I reverse the order, then all is well. If I turn st1 into some other random string, all is well. However, as long as st1 is a string that comes from the WCF call, everything after st1 in the MessageBox is ignored.So what is coming from the WCF call?

The lines are these:

resp.GetResponseStream.Read(buff, 0, 99)
Return Encoding.ASCII.GetString(buff)

resp is a WebResponse object, though that shouldn't matter, as the key is that I take a stream, move it to a buffer, then turn that buffer into a string. What is it about the string that is alterning the way the string is displayed.If I highlight the "st1 & "Blue"" part, and press Shift+F9, it is all there. What I do notice is that there is a significant space beyond the end of st1 and before the Blue. Trim doesn't get rid of this space. My theory is that what is there is a series of Null bytes, and MessageBox is interpreting that as the end of the string and terminating the display at that point, even though it shouldn't really be terminated there. That's especially interesting because I can add in an Environment.NewLine, which would normally add a new line, but even that gets ignored.

View 5 Replies

2010 Collection Class Oddity

Sep 28, 2010

I converted a project from 2008 to 2010 to be able to use the TPL.I've updated the compile target to .NET 4. Everything seems good, including the .NET 4 specific TPL stuff...except that:[code]

View 7 Replies

VS 2005 Data Grid View Oddity

May 28, 2009

I'm working with a DataGridView. The DataSource for the DataGridView is set to a DataTable that I've populated with the results of a SQL query.

Then, I add an extra column to the DataGridView, a DataGridViewCheckBoxColumn. This allows the user to select a number of records in the datatable in order to save out selected files, represented by the rows of the datatable/DataGridView.

I have buttons that will programmatically check/uncheck all of these CheckBoxes, as there are frequently several hundred rows in the DataGridView. The user can also check/uncheck any number manually.[CODE..]

View 8 Replies

Random System.StackOverflowException Error

Apr 27, 2010

I get a code from a app and i would to test it alone: this is a xor decrypter. Sometimes it works well and often it makes me cry with System.StackOverflowException from Public Sub New(). there is lot of line (0 to 999) like this [Code].

View 10 Replies

Random Exceptions: System.IO.IOException: The Handle Is Invalid

Dec 27, 2011

I have a relatively simple VB.NET app. It targets framework 2.0 from Visual Studio 2010. The app works fine most of the time, except that the users sometimes receive the

following exceptions. The error is completely random and somewhat rare. I haven't been able to trap it while in a development environment. It also doesn't appear to be

pointing at my code. My app continues to run if the users ignore the error. How would I trap and handle this error?

View 1 Replies

Creating A New Random Generator Each Time Should Reduce The Number Of Random Repetitions?

May 26, 2011

I've read numerous posts and threads about random number generation, but I havent' run across this.If I generate a bunch of random numbers, the results are radically different if I create a new Random generator for each number than if I use on Random generator for all the numbers. The results are much more consistent and evenly distributed if I use the same Random generator.I would have thought the opposite,because creating a new Random generator each time should reduce the number of random repetitions, if a different time slice is used to create the random number.[code]......

View 9 Replies

Bug In VB 2010 RC - Class Random - Always Produces The Same Random Numbers In The Same Sequence

Apr 4, 2010

The class Random is out right defective. It always produces the same random numbers in the same sequence. Things I have tried so far is every kind of seed you can think of as well as Randomize. The result is that I always get the same random numbers in exactly the same sequence.

View 4 Replies

VS 2010 Draw Rectangle (random Times, Random Location)?

Nov 26, 2011

I am practicing using the drawing commands, and have gotten a grass background and black happy face that moves around the background.It's a 10x10 grid of 50 pixels.I want (at the moment, when i press enter) it to generate a random number of trees (15 ~ 25) at random locations on the background. The program doesn't freak out about anything, and the variables seem to be right (using stop commands) but it's not drawing anything. Here is the code for the "GenerateTrees" command I have for when I press enter.

Private Sub GenerateTrees()
NumberOfTrees = Int(Rnd() * 10) + 15
For i = 0 To NumberOfTrees - 1
bmap.MakeTransparent(Color.Fuchsia)

[code].....

View 4 Replies

Assigning Integers Using Random.org Instead Of The Local Random Feature?

Oct 10, 2011

I would like to use integers generated by Random.org in a small desktop widow app. Im using visual basic. All My search terms bring up unrelated (to My issue) information. Currently I am using the local random statement/command.

View 4 Replies

Code Generate A Random Number / How To Make It 'TRULY' Random

May 29, 2011

I am trying to make a texas hold em game and it is of the utmost importance that my code generate a random number. But using a random number function that I always end up with a lot of the same numbers over and over again. Any ideas on how to make it "TRULY" random? [code]

View 3 Replies

VS 2010 - Image Viewer - Random Number Is Not That Random At All

Apr 19, 2012

I've made an image viewer which opens a random image from a specified folder, but the random number is not that random at all... I've already used Randomize(), but without result.

View 3 Replies

Random Numbers And Random Strings

Nov 24, 2009

I don't take programming lessons at school or anything, and I'm starting to (try to) teach myself about random things.Currently I'm making an app that has 3 functions:

-Random Integer (1 to 100)
-Random Answer (Yes or No, similar to a coin flip)
-Random Dice Roll (1 to 6)

How would I go about doing this?At the moment all I know about random numbers etc. is that I will need to do something along the lines of Dim dice As New Random or something like that, but, like I mentioned, I have no idea.I am well aware of the DIC rules that you won't write the code for me/do my "homework(?)" for me, and that's not what I'm asking.

View 2 Replies

Generating Salt - LENGTH Of Salt Be Random - Fixed Or A Random Number Within A (min/max) Range ?

Nov 26, 2011

VS2010 (SP1) / .NET 4 on Windows XP. The question is simple, the answer; not so much. When generating a salt, should the LENGTH of the salt be random, fixed or a random number within a (min/max) range? I am using RNGCryptoServiceProvider to generate the salt, just unsure of the length of the salt.

View 12 Replies

Random Function Isn't Random?

Nov 25, 2009

I got a loop like this:

For KeywordsLoop = 1 To 150
TextFile1.WriteLine(RandomSuffix())
Next

[code].....

View 4 Replies

Cannot Import System.Windows.Media.Imaging And System.Windows.Forms Or System.Reflect?

Mar 16, 2009

With the following imported namespaces in my project :

Imports System.Windows.Forms
Imports System.Reflection
.. I cannot add..

[code].....

View 6 Replies

IDE :: DataGridView1_CellLeave(sender, New System.EventArgs), Unable To Cast Object Of Type 'System.EventArgs' To Type 'System.Windows.Forms.DataGridViewCellEventArgs'.

Jun 27, 2011

VB 2008, DataGridView,DataGridView1_CellLeave(sender, New System.EventArgs)

"Unable to cast object of type 'System.EventArgs' to type 'System.Windows.Forms.DataGridViewCellEventArgs'."

What is the Correct String for "New System.EventsArgs"

Anybody there is to help me out.

View 1 Replies

Error - LINQ To Entities Does Not Recognize The Method 'System.Object IIf(Boolean, System.Object, System.Object)'

Jul 29, 2011

I am getting following error whenever I want to use IIf function inside entity framework query.

LINQ to Entities does not recognize the method 'System.Object IIf(Boolean, System.Object, System.Object)' method, and this method cannot be translated into a store expression.

View 1 Replies

Method 'System.Object CompareObjectEqual(System.Object, System.Object, Boolean)' Has No Supported Translation To SQL.?

Apr 16, 2010

What do I need to convert?

Dim CEESearchByAppNo = From CEEsearch In dbCEE.tblScanneds _
Where CEEsearch.AppNo = iAppNo

[code].....

View 5 Replies

Unable To Cast Object Of Type 'System.String' To Type 'System.Predicate`1[System.String]

May 13, 2009

I am getting the following erro message: "Unable to cast object of type 'System.String' to type 'System.Predicate`1[System.String]'." on the line of code: If Not StrgFrag.Exists(wrd) Then I was expecting a True/False response and assumed it would work given that wrd is a String variables and StrgFrag in a List(of String). Do I need to reference the wrd variable differently? Dim StrgFrag As New List(Of String)

[Code]....

View 2 Replies

Error: A First Chance Exception Of Type 'System.InvalidOperationException' Occurred In System.Data.dll

May 5, 2011

I am using VS 2008, Office 2007, and Win7 Home Premium on my system.I have a simple application which should be a breeze to build. All I am attempting to do is pull data from an Access database with four small tables into a data grid on a windows project. Should be simple, set up the data connection, choose a datagrid from the table in the data source view, drag it onto the page and done, right?I can't get it to work. It will all work fine until I attempt to run or debug the project. The data will not show up. The data grid does, but I get this error: A first chance exception of type 'System.InvalidOperationException' occurred in System.Data.dll

As I said, the project seems to build fine, but it will not pull the data. After the initial build I get the message that Windows will show this page in Compatibility View. Is it something with Win7 Home Premium, or a setting somewhere?

View 4 Replies

System.io.fileinfo Cannot See A File In System Folder On Windows Server 2008 64bit

Jan 28, 2010

I have a utility that is a simple exe that is not installed compiled with VS2005 and works well. But when I upgraded to VS2008 the utility can no longer locate files in the active system folder. I have UAC turned off and am logged in as the Administrator and it still can not locate a file that I can see in Windows Explorer. The file I am looking for is PakMgr.exe.

View 1 Replies

System.TypeInitializationException: The Type Initializer For 'System.ServiceModel.ClientBase' 1' Threw An Exception

Dec 22, 2009

I'm using express 2008 build the windows app. and in the app, it calls a webservice which was built by VS2003.It works fine on most PCs. however, there is one PC, it always shows this error:

System.TypeInitializationException: The type initializer for 'System.ServiceModel.ClientBase' 1' threw an exception
....
System.configuration.ConfigurationErrorException: Configuration system failed to initialize ---> System.Configuration.ConfigurationErrorsException:
Unrecognized configuration section system.serviceModel
.....

however, the configuration file was generated by express 2008, and it seems there is no error.

View 2 Replies

Unable To Cast Object Of Type 'System.EventArgs' To 'System.ComponentModel.CancelEventArgs'

Jul 11, 2012

I have a text-boxes that use both the validating event as well as the lostfocus event.I have pinpointed the exception in the post title to the validating events.[code]Maybe I am unaware that CancelEventArgs are not suppose to be used in the validating event? [code]

View 4 Replies

VS 2008 : Error - Cannot Perform 'Like' Operation On System.Int32 And System.String"

Nov 2, 2009

I'm trying to use DataView.Rowfilter and I'm getting an exception which says "Cannot perform 'Like' operation on System.Int32 and System.String".

Here's the code...

Dim str2 As Double = CDbl(searchSTR)
Me.shipperDV.RowFilter = fieldName & " LIKE '*" & str2 & "*'"

View 7 Replies

A First Chance Exception Of Type 'System.UnauthorizedAccessException' Occurred In System.DirectoryServices.dll

Dec 16, 2010

I would like to create a local user on a windows 7 PC, but gets the following error when commitchanges runs. I am administrator on the PC:

A first chance exception of type 'System.UnauthorizedAccessException' occurred in System.DirectoryServices.dll

Here is my code:

CODE:

I am using Visual Basic 2010 ultimate in Visual Studio 2010.

View 4 Replies

C# - What Could Cause System.Timers.Timer.set_Enabled Property To Throw A System.NullReferenceException

Apr 4, 2012

Here is the stack trace:

2012-03-16 19:15:09Z E System.NullReferenceException: Object reference not set to an instance of an object.
at System.Timers.Timer.set_Enabled(Boolean value)
at System.Timers.Timer.Stop()

Here's the code:

Timer declared as private member variable.
Private _myTimer As System.Timers.Timer
Initialize timer method.

[code]....

The timer has to have a value or else the Timer.Stop() call would be throwing the exception. This is a sporadic error and I'm just trying to see if anyone has experienced this before or if anyone has any ideas of what could be causing it. It is occuring in a WinForms application in the event handler for the Elapsed event of the Timer, but it is only occuring sporadically on the users computer. I haven't been able to reproduce the error myself.

View 2 Replies

DB/Reporting :: Error: Cannot Perform '=' Operation On System.Int32 And System.String

Mar 6, 2010

I wrote the code below which calculates the length of a line on the form and save record. An error occurs when the programme tries to save the record. It gives me "Cannot perform '=' operation on System.Int32 and System.String" error. I checked the data type of "ID"(int), "Microscope"(Varchar), "Magnification"(int) and "Calibration"(Decimal), and they are fine so far as I know.

Code:
Private Sub btnEnd_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btnEnd.Click
'Check if the length textbox is not empty

[Code].....

View 4 Replies

Error : An Unhandled Exception Of Type 'System.StackOverflowException' Occurred In System.dll

Mar 21, 2011

get out from the below loop

Shared Function GetIPAddress() As String
Dim sam As System.Net.IPAddress
Dim sam1 As String

[code]....

View 4 Replies

Exception Of Type 'System.ComponentModel.Win32Exception' Occurred In System.Drawing.dll

Oct 14, 2011

I have a program that creates a Treeview from information procured through an ODBC query and dumped into a dataset. I have three such queries set up via radial buttons as well as a refresh button that triggers whatever radial button is active at the time it's clicked. The purpose of this program is to allow drag-and-drop of selected nodes, ending with a post to the database that officially makes that change of assignment to the new node.

[Code]...

View 5 Replies







Copyrights 2005-15 www.BigResource.com, All rights reserved