473,324 Members | 2,581 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,324 software developers and data experts.

how to generate non repeating num randomly? im using vb 6

How do I generate non repeating number randomly?

Expand|Select|Wrap|Line Numbers
  1. Private Sub cmdGetRandomNumber_Click()
  2.     Dim intResult As Integer
  3.     '// Initializes the random-number generator, otherwise each time you run your
  4.     '// program, the sequence of numbers will be the same
  5.  
  6.     Randomize
  7.     intResult = Int((10 * Rnd) + 1) '// Generate random value between 1 and 100.
  8.     Label1 = intResult '// Display result
  9.  
  10. End Sub
the results: it gives 2 then later on the number 2 will appear again.i want random number but its not repeating. .pls help!
Dec 6 '14 #1
1 1281
Luuk
1,047 Expert 1GB
If you store the numbers that already appeared, than you can compare the new number with this list.

Downside of this: getting a new 'random' number will get slower for every new number.

Challenge: you, as a student, should be able to solve it ;)
Dec 8 '14 #2

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

Similar topics

1
by: jtsree | last post by:
I am Using (Windows XP) Visual Studio.net 2003 professional edition working on VB.net language. I am bulding a very very simple project in VB.net where i connect to Access Database by dragging...
1
by: Srihari | last post by:
I'm trying to develop a tree structure using javascript. The node values of the tree are generating from a mysql table depending on login. The tree structure contains 3 sub levels. I developed...
3
by: Brian Kwan | last post by:
Project Description: Develop a web application to help manage sale operations. There is a function that to generate a report using data in database, which is a Word document on server and let user...
0
by: ganesh | last post by:
How to generate Word document using asp.net. other than using Response.ContentType = "application/msword" thnx Ganesh.
5
by: Raghuram | last post by:
I want to generate some set of chars which are more than 4 chars randomly. . .. how can i do that
2
by: andy gilman | last post by:
When I generate an xsd *schema* I get something like : <?xml version="1.0" encoding="utf-16"?> <xs:schema xmlns:xs="http://www.w3.org/2001/XMLSchema"> <xs:element name="AccountsReceivable">...
0
by: Raja yashwanth Reddy Gunda | last post by:
Hi I couldn't generate any report.My application is developed using .Net(MDI Frame application-windows forms) and I am trying to generate the report but couldn't succeed.If I do the same...
1
by: shruthid | last post by:
can we generate a class for the following xsd file using xsd.exe?? it does'nt contain a complex type.. <?xml version="1.0" encoding="UTF-8" ?> <xs:schema...
0
by: Pooria | last post by:
Is there a macro that can get a text as input like "abc" and then extract characters in that text and generate a code using them, something like "{'a','b','c'}" ? thanks.
0
by: ryjfgjl | last post by:
ExcelToDatabase: batch import excel into database automatically...
0
by: Vimpel783 | last post by:
Hello! Guys, I found this code on the Internet, but I need to modify it a little. It works well, the problem is this: Data is sent from only one cell, in this case B5, but it is necessary that data...
0
by: jfyes | last post by:
As a hardware engineer, after seeing that CEIWEI recently released a new tool for Modbus RTU Over TCP/UDP filtering and monitoring, I actively went to its official website to take a look. It turned...
0
by: ArrayDB | last post by:
The error message I've encountered is; ERROR:root:Error generating model response: exception: access violation writing 0x0000000000005140, which seems to be indicative of an access violation...
1
by: CloudSolutions | last post by:
Introduction: For many beginners and individual users, requiring a credit card and email registration may pose a barrier when starting to use cloud servers. However, some cloud server providers now...
1
by: Shællîpôpï 09 | last post by:
If u are using a keypad phone, how do u turn on JavaScript, to access features like WhatsApp, Facebook, Instagram....
0
by: af34tf | last post by:
Hi Guys, I have a domain whose name is BytesLimited.com, and I want to sell it. Does anyone know about platforms that allow me to list my domain in auction for free. Thank you
0
by: Faith0G | last post by:
I am starting a new it consulting business and it's been a while since I setup a new website. Is wordpress still the best web based software for hosting a 5 page website? The webpages will be...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 3 Apr 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome former...

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.