Random Numbers and Tic Tac Toe with Visual Basic .NET DC

The holidays are a time for fun. Learn about random numbers from Paul Kimmel's latest Visual Basic Today column from CodeGuru.com. Includes a Tic Tac Toe game!

Local Companies

Capital Management Consulting,
(202) 527-2022
5411 13th St., NW
Washington, DC
Sophisticated Technologies, Inc.
(301) 731-1015
3311 Grayvine Lane
Washington, DC
Peyton McCall, Inc.
(202) 327-4902
7504 Alaska Ave
Washington, DC
Dantech Corporation Inc.
(888) 868-9015
1700 Verbena St., NW
Washington, DC
The Myta Corporation
(301) 468-7740
6901 Barrett Lane
Bethesda, DC
Symbiont, Inc.
(202) 887-6800
1320 Fenwick Lane
Silver Spring, DC
Enlightened, Inc.
(202) 783-4655
666 11th St., NW
Washington, DC
Evergreen Computer Services, Inc
(301) 758-2986
12421 Alamanco Way
Washington, DC
The Carrington Group, Inc
(202) 726-4441
1818 New York Ave., NE Suite 115
Washington, DC
NGEN, LLC
(301) 531-9700
1101 Mercantile Lane
Washington, DC

provided by: 
Originally published at Internet.com


If you are a little like I am you will be doing something with your computer even during the holidays. (More than likely I will be playing Red Alert 2 with the kids, but I may sneak in a little writing.) For you workaholics, I have included a little holiday fare. This way you will be able to do something constructive, yet be able to tear yourself away when company comes knocking on the door.

Random numbers are commonly employed in applications for a wide variety of reasons. In this week's letter let's take a quick look at the Random class in the Common Language Runtime.

The System Namespace



The System namespace is a root namespace in the Common Language Runtime (CLR). One of the classes in the System namespace is the Random class. (That's right! Random numbers are encapsulated in a class in .NET.) Like VB6 random numbers are based on a mathematical algorithm from a finite set of numbers. The result is that you get pseudo-random numbers, but these numbers are random enough for many practical purposes (just not the lottery).

Random numbers in VB.NET can be initialized with or without a seed value and can be constrained to a range of numbers. If the same seed is used then the generated number sequence will be identical. A good strategy is to seed the random numbers using a unique value like the time. Table 1 describes the members of the Random class and is followed by some code examples demonstrating how to use the Random class. Members of the System.Random class. Member Name Description New() Constructs instance of Random Class. New(ByVal Seed As Integer) Constructs instance of Random class using Seed value. Next() As Integer Returns next integer in the random number sequence. Next(ByVal maxValue As Integer) As Integer Returns a positive integer less than maxValue. Next(ByVal minValue As Integer, ByVal maxValue As Integer) As Integer Returns a number greater than or equal to minValue and less than or maxValue. NextBytes(ByVal buffer() As Byte) Returns an array of random bytes greater than or equal to 0 and less than Byte.MaxValue. NextDouble() As Double Returns a random Double between 0.0 and 1.0...

Read article at Internet.com site

Featured Local Company

Symbiont, Inc.

(202) 887-6800
1320 Fenwick Lane
Silver Spring, DC

Related Local Events
DC Chamber Technology Series: Session 4
Dates: 12/10/2009 - 12/10/2009
Location: Robert H. Smith School at the Ronald Reagan Building and International Trade Center
Washington, DC
View Details

ACIs 3rd Annual Carbon Capture and Sequestration Summit
Dates: 9/14/2009 - 9/15/2009
Location: Omni Shoreham Hotel
Washington, DC
View Details

3rd Carbon Capture and Sequestration Summit
Dates: 9/14/2009 - 9/15/2009
Location: Omni Shoreham Hotel
Washington, DC
View Details

Topics: 
Architecture & Design Languages & Tools Project Management Web Services
Database Microsoft & .NET Security Wireless
Java Open Source Techniques XML