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

Combinations

I need code in VB for combinations
For example k of n numbers (6 of 45) for lottary
Jan 12 '07 #1
2 976
bplacker
121 100+
after one google search i found this, you'll have to download the source code and change it to .net, but it should help. You can't expect someone to do ALL the work for you!

http://www.freevbcode.com/ShowCode.asp?ID=3033
Jan 12 '07 #2
Hello jaakinye

This code should do it.

Expand|Select|Wrap|Line Numbers
  1. int1 = 1 + Rnd() * 44
  2. int2 = 1 + Rnd() * 44
  3. Do While int1 = int2
  4. int2 = 1 + Rnd() * 44
  5. Loopint3 = 1 + Rnd() * 44
    Do While int1 = int3 Or int2 = int3
  6. int3 = 1 + Rnd() * 44
  7. Loopint4 = 1 + Rnd() * 44
    Do While int1 = int4 Or int2 = int4 Or int3 = int4
  8. int4 = 1 + Rnd() * 44
  9. Loopint5 = 1 + Rnd() * 44
    Do While int1 = int5 Or int2 = int5 Or int3 = int5 Or int4 = int5
  10. int5 = 1 + Rnd() * 44
  11. Loopint6 = 1 + Rnd() * 44
    Do While int1 = int6 Or int2 = int6 Or int3 = int6 Or int4 = int6 Or int5 = int6
  12. int6 = 1 + Rnd() * 44
  13. Loop
Jan 12 '07 #3

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

Similar topics

1
by: Jim Hubbard | last post by:
Does anyone have any code for doing combinations in VB.net or visual basic ? I'd like to be able to get an array of combinations (not permutations) of words from a base group of words while...
36
by: rbt | last post by:
Say I have a list that has 3 letters in it: I want to print all the possible 4 digit combinations of those 3 letters: 4^3 = 64 aaaa
1
by: M a n i s h | last post by:
i have been trying to build a program to find various combinations of a string. the problem is that if there are multiple similar characters in the string then the program displays multiple similar...
19
by: Thomas Cameron | last post by:
Hello all, I have an array of values which I would like to generate all possible combinations for. And example would be the values "a,b,c". This would produce the following: a ab abc ac
15
by: Thomas Cameron | last post by:
Hello all, I have an array of values which I would like to generate all possible combinations for. And example would be the values "a,b,c". This would produce the following: a ab abc ac b
3
by: Ryan | last post by:
I've been trying to find an algorithm that will output all of the possible combinations of items in an array. I know how to find the number of combinations for each set using nCr=n!/(r!(n-r)!) ...
2
by: GrantMagic | last post by:
I have found that some strange combinations of characters in a URL can cause an error in my ASP.NET application. This is regarding URL Paramters For example: if i have the URL:...
0
by: Louis Aslett | last post by:
I hope this is the correct newsgroup for this query (if not please give me a pointer to where is best): I understand the theory of normalisation etc and am trying to follow best practices in the...
5
by: Bails | last post by:
Hi all I have a theory for a lotto system and need help on how to code it. I want to create 1 massive database with EVERY combination of numbers possible in a given lotto system, then remove all...
2
by: zgfareed | last post by:
Can anyone suggest an algorithm or function to generate combinations/ permutations of a group of substrings stored in a vector. The substrings consists of 3 letters and the resulting string...
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
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...
0
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
0
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...

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.