There's no such thing as a stupid question, but they're the easiest to answer.
JoinTour
Login
 
Software Development
Tag Cloud
audio blue screen boot bsod computer cpu crash dell desktop driver drivers error excel external hard drive firefox freezes freezing hard drive hardware hijackthis internet internet explorer ipod itunes laptop malware motherboard mouse network networking outlook 2007 power printer problem ram router screen slow sound trojan upgrade usb virtumonde virus vista vista 32-bit windows windows xp winxp wireless
Search
Search in:
 
Advanced Search
Tech Support Guy Forums > Software & Hardware > Software Development >
VB.NET non-repeating random number


Computer problem? Tech Support Guy is completely free -- paid for by advertisers and donations. Click here to join today! If you're new to Tech Support Guy, we highly recommend that you visit our Guide for New Members. Enjoy!

Closed Thread
 
Thread Tools
Ciberblade's Avatar
Computer Specs
Community Moderator with 15,703 posts.
 
Join Date: Sep 2003
Location: Heart of the Bluegrass Ky
Experience: Mostly Harmless
04-Sep-2004, 10:38 PM #1
VB.NET non-repeating random number
I am trying to write a method that I can pass in two values (low number, high number) and will return a non-repeating random number within this range, one number at a time (possibly button click, not sure yet - I'll tackle that later). Once all available numbers are used, I want it to return a -1. I cannot move on until I get this tested functionally. I am trying to make use of a binary array to keep track of used numbers by index. Here is what I have so far:

Any ideas?
Attached Thumbnails
vb-net-non-repeating-random-nrrandom.jpg  
__________________
82,268
*AD-Aware*AIDA32*AVG-7*Filemon*Hijack This*PortMon*Process Explorer*TSG Forums menu*

Far righty-tighty Wingnut Libertarian ( ) - annoyingly free thinking with no tendency to agree on anything with anyone. - BF

If you wish...you can now come to church with me! A church that is NOT normal...a church for people who don't like 'church'
Chicon's Avatar
Computer Specs
Distinguished Member with 6,695 posts.
 
Join Date: Jul 2004
Location: 50° 34' 07.13" N - 04° 10' 23.
Experience: Second socks retriever
06-Sep-2004, 03:21 AM #2
Hi ciberblade,

My first thought was to use the old VB6 rnd function, but after having read this :
http://www.dotnet247.com/247referenc...26/131087.aspx ...

There are solutions to your problem.
Ciberblade's Avatar
Computer Specs
Community Moderator with 15,703 posts.
 
Join Date: Sep 2003
Location: Heart of the Bluegrass Ky
Experience: Mostly Harmless
07-Sep-2004, 09:14 PM #3
solved
Chicon ~ thanks for the reference

I ended up setting a counter equal to the size of my array, then incrementing that counter each time through the loop - using that to index my boolean. It is satisfying
Closed Thread

THIS THREAD HAS EXPIRED.
Are you having the same problem? We have volunteers ready to answer your question, but first you'll have to join for free. Need help getting started? Check out our Welcome Guide.


Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)
 
WELCOME TO TECH SUPPORT GUY! Are you looking for the solution to your computer problem? Join our site today to ask your question -- for free! Our site is run completely by volunteers who want to help you solve your computer problems. See our Welcome Guide to get started.



Thread Tools


You Are Using:
Server ID
Advertisements do not imply our endorsement of that product or service.
All times are GMT -4. The time now is 12:03 PM.
Copyright © 1996 - 2008 TechGuy, Inc. All rights reserved.
Powered by vBulletin, Copyright © 2000 - 2008, Jelsoft Enterprises Ltd.
Search Engine Optimization by vBSEO 3.1.0
Powered by Cermak Technologies, Inc.