473,386 Members | 1,819 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,386 software developers and data experts.

radom

i jsut started to learn vb 2005 at school and i need to know a how to make a value be radom
Nov 6 '07 #1
2 1065
kunal pawar
297 100+
Using Random Class u can generate random numbers
Random RandomClass = new Random();
Nov 6 '07 #2
balabaster
797 Expert 512MB
Using Random Class u can generate random numbers
Random RandomClass = new Random();
We're not supposed to help with school assignments so be careful what you ask for in future...

Here is a standard function that you'll find littering the internet though

Expand|Select|Wrap|Line Numbers
  1. Public Function RandomNum(ByVal Low As Integer, ByVal High As Integer) As Integer
  2.   Randomize() 
  3.   Return CType(Rnd() * (High - Low), Integer) + Low
  4. End Function
  5.  
  6. Dim MyRandomNum As integer = RandomNum(10, 20)
It allows you to pass a low end number and a high end number and a pseudo-random number will be generated between those two numbers. In the example I used 10 as the low end and 20 as the high end. Take note of the Randomize and Rnd functions which are the core of the method.

I've had limited success with the Random class for this purpose. It seems that the mechanism built into it for generating the random number is sensitive to time so if you need to generate a large amount of apparently random numbers this function will perform better than the Random class.
Nov 6 '07 #3

Sign in to post your reply or Sign up for a free account.

Similar topics

3
by: Qvx | last post by:
Hello, I'we written a simple web deployment program which scans for the changes made to local copy of web site. Changed files are than packaged into a zip file and deployed to web server. Now...
4
by: Kaustubh | last post by:
Well Hie, i need all you genius guys help. Well i have databse of quotes in TXT format i want the javascript which ll radomize that database means everytime when user come on my page then script...
3
by: Just Me | last post by:
I know nothing about XML and am asking this so I know if I should spend some time learning. I had a VB6 address book app that I converted to .net It reads and writes records in a random file....
3
by: Bartosz Majewski | last post by:
Hello, I have a question. Is there any possibility to compile MS Access database (e.g. *.mdb file) to standalone, executable application? I'd like to use such database application on a computer...
5
by: David | last post by:
Hi all: I am processing a 3D bitmaps(essentially ~1024 2D bitmaps with a size of 1MB each). If I want read large amount of radom data from this series, how could I buffer the file to get...
26
by: Gary Wessle | last post by:
Hi I need help to generate some random numbers between 2 and 8. #include <cstdlib> using std::rand; the following was out of my range, int main() {
331
by: Xah Lee | last post by:
http://xahlee.org/emacs/modernization.html ] The Modernization of Emacs ---------------------------------------- THE PROBLEM Emacs is a great editor. It is perhaps the most powerful and...
5
by: radom | last post by:
Can some one show me how to use SaveFileDialog in vb 08. thanks radom
2
by: Don Quijote de Nicaragua | last post by:
Hi, Everyone, I'm trying to generate a random number between a range of numbers, some idea. Thanks. Don Quijote de Nicaragua. Elder Soto.
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.