Quantcast

Maximum PC

It is currently Tue Sep 30, 2014 2:57 pm

All times are UTC - 8 hours




Post new topic Reply to topic  [ 64 posts ]  Go to page 1, 2, 3, 4  Next
Author Message
 Post subject: I need SOME MORE help with Visual Basic.NET 2003 (uh!)
PostPosted: Sat Aug 07, 2004 12:13 pm 
8086
8086

Joined: Mon Jul 26, 2004 8:40 am
Posts: 55
Location: Illinois, in the U.S. of A.
I'm putting images from an ImageList in a PictureBox, but it keeps showing the 16x16 thumbnail size that it shows when you go into the ImageList Image Collection. The images are actually 150x250, but it keeps displaying the thumbnail instead of the actual images that are in the ImageCollection. Here's what I'm doing:

a = ImageList1.Images.Item(0)
b = ImageList2.Images.Item(1)
c = ImageLIst3.Images.Item(2)
...
(If Card = 2 Then)
PictureBox1.Image = a
(ElseIf Card = 3 Then}
PictureBox1.Image = b
... and so on

You see, I'm making BlackJack, and I need it to show the card that corresponds to what the user got (for example, if the user decided to "Hit", and he got a "5" card, I need it to show the 5 card. Like I said, I have all the need cards in the ImageList, but I can't seem to call them up correctly in the PictureBox. Please help!

Oh, and the help topic only provides info on getting images "FromFile". I don't want to do that, right?


Top
  Profile  
 
 Post subject:
PostPosted: Sat Aug 07, 2004 12:17 pm 
8086
8086

Joined: Mon Jul 26, 2004 8:40 am
Posts: 55
Location: Illinois, in the U.S. of A.
Nevermind. I re-installed all the images into the ImageList, and everything works fine now. I'm over 60% done now, and it'll only take me another 2 or 3 days to finish (assuming I don't run into any more big problems. But, I got all the big stuff out of the way, and now it's basically pretty much the same repititious coding and code reusing and stuff like that. Stuff that already has been proven to work, but just has to be modified slightly for different control names and stuff like that across different forms.


Top
  Profile  
 
 Post subject: Re: I need SOME MORE help with Visual Basic.NET 2003 (uh!)
PostPosted: Sun Aug 08, 2004 6:10 pm 
Bitchin' Fast 3D Z8000*
Bitchin' Fast 3D Z8000*
User avatar

Joined: Tue Jun 29, 2004 11:32 pm
Posts: 2555
Location: Somewhere between compilation and linking
Derek § wrote:
a = ImageList1.Images.Item(0)
b = ImageList2.Images.Item(1)
c = ImageLIst3.Images.Item(2)
...
(If Card = 2 Then)
PictureBox1.Image = a
(ElseIf Card = 3 Then}
PictureBox1.Image = b
... and so on

Just curious.... how do you assign a value to a variable like Card in VB?

Also, I take it that VB doesn't have the equivalent of a switch statement?


Top
  Profile  
 
 Post subject:
PostPosted: Thu Aug 12, 2004 2:34 pm 
8086
8086

Joined: Mon Jul 26, 2004 8:40 am
Posts: 55
Location: Illinois, in the U.S. of A.
I used a randomizing algorithm. I based it between 0-1. I divided 1/13, 2/13, 3/13, etc. (there are 13 different possible card values; Ace(1),2,3,4,5,6,7,8,9,10,J,Q,K) to see the decimals I would get. For example, 0-0.077 represents the 2 card. Oh, hold on. I'll just show you the code in a bit, BRB.


Top
  Profile  
 
 Post subject: Re: I need SOME MORE help with Visual Basic.NET 2003 (uh!)
PostPosted: Sat Aug 14, 2004 8:05 pm 
Bitchin' Fast 3D Z8000
Bitchin' Fast 3D Z8000
User avatar

Joined: Sat Jun 26, 2004 3:44 pm
Posts: 513
Location: Vancouver Island
Gadget wrote:
Derek § wrote:
a = ImageList1.Images.Item(0)
b = ImageList2.Images.Item(1)
c = ImageLIst3.Images.Item(2)
...
(If Card = 2 Then)
PictureBox1.Image = a
(ElseIf Card = 3 Then}
PictureBox1.Image = b
... and so on

Just curious.... how do you assign a value to a variable like Card in VB?

Also, I take it that VB doesn't have the equivalent of a switch statement?


It uses a Select Case /End Case structure like this:

Select Case

Case 1

Case 2

Case 3

End Case

Remember it's VB...sometimes using an Else If is more efficient. As well you can't pass controls or static indexes to a Select Case statment unless they are wrapped up in a variable - you know how VB 6.0 has Control Arrays...nope not in VB.NET, either. Doesn't make sense, but you can't pass it the index anyway, at least not without iterating through the array and assigning it IndexOf.

Why this is, I dunno, but it's not hard to work around.


Top
  Profile  
 
 Post subject:
PostPosted: Sun Aug 15, 2004 3:06 am 
Bitchin' Fast 3D Z8000*
Bitchin' Fast 3D Z8000*
User avatar

Joined: Tue Jun 29, 2004 11:32 pm
Posts: 2555
Location: Somewhere between compilation and linking
Derek § wrote:
I used a randomizing algorithm. I based it between 0-1. I divided 1/13, 2/13, 3/13, etc. (there are 13 different possible card values; Ace(1),2,3,4,5,6,7,8,9,10,J,Q,K) to see the decimals I would get. For example, 0-0.077 represents the 2 card. Oh, hold on. I'll just show you the code in a bit, BRB.

A more common, and cleaner approach, is to use random to use the mod operator w/ random to generate values from 0 to 12. Random.getNum() * 1000 % 13 should do the trick.


Top
  Profile  
 
 Post subject: Re: I need SOME MORE help with Visual Basic.NET 2003 (uh!)
PostPosted: Sun Aug 15, 2004 3:09 am 
Bitchin' Fast 3D Z8000*
Bitchin' Fast 3D Z8000*
User avatar

Joined: Tue Jun 29, 2004 11:32 pm
Posts: 2555
Location: Somewhere between compilation and linking
Wolfmann wrote:
Gadget wrote:
Derek § wrote:
a = ImageList1.Images.Item(0)
b = ImageList2.Images.Item(1)
c = ImageLIst3.Images.Item(2)
...
(If Card = 2 Then)
PictureBox1.Image = a
(ElseIf Card = 3 Then}
PictureBox1.Image = b
... and so on

Just curious.... how do you assign a value to a variable like Card in VB?

Also, I take it that VB doesn't have the equivalent of a switch statement?


It uses a Select Case /End Case structure like this:

Select Case

Case 1

Case 2

Case 3

End Case

Remember it's VB...sometimes using an Else If is more efficient. As well you can't pass controls or static indexes to a Select Case statment unless they are wrapped up in a variable - you know how VB 6.0 has Control Arrays...nope not in VB.NET, either. Doesn't make sense, but you can't pass it the index anyway, at least not without iterating through the array and assigning it IndexOf.

Why this is, I dunno, but it's not hard to work around.

So he could do something like this instead, right?

Code:
switch(card) {
case 0:  //do whatever...
case 1: //do whatever....
...
}


Top
  Profile  
 
 Post subject:
PostPosted: Sun Aug 15, 2004 7:35 am 
I'd rather be modding!
I'd rather be modding!
User avatar

Joined: Fri Jun 25, 2004 3:47 pm
Posts: 3731
Location: Las Vegas
Gadget wrote:
Derek § wrote:
I used a randomizing algorithm. I based it between 0-1. I divided 1/13, 2/13, 3/13, etc. (there are 13 different possible card values; Ace(1),2,3,4,5,6,7,8,9,10,J,Q,K) to see the decimals I would get. For example, 0-0.077 represents the 2 card. Oh, hold on. I'll just show you the code in a bit, BRB.

A more common, and cleaner approach, is to use random to use the mod operator w/ random to generate values from 0 to 12. Random.getNum() * 1000 % 13 should do the trick.


wouldn't rand.num() * 168 % 13 work better? The should always give a modulus of 0 - 12. or rand.num() 1689 % 130 for better odds calculation.

also, you could have a divide by 0 exception could you not?

Manta


Top
  Profile  
 
 Post subject:
PostPosted: Sun Aug 15, 2004 9:39 am 
8086
8086

Joined: Mon Jul 26, 2004 8:40 am
Posts: 55
Location: Illinois, in the U.S. of A.
Wow, my randomizing code doesn't work when I use it in VB 2005 Express Edition. Wonder why? Maybe I'll go with MantaBase's form. The variable that holds the random values is x, and it's declared as VariantType, vs. in the older one (VB 2003.NET), it wasn't declared at all. Could that have anything to do with it?


Top
  Profile  
 
 Post subject:
PostPosted: Sun Aug 15, 2004 2:38 pm 
Bitchin' Fast 3D Z8000*
Bitchin' Fast 3D Z8000*
User avatar

Joined: Tue Jun 29, 2004 11:32 pm
Posts: 2555
Location: Somewhere between compilation and linking
MantaBase wrote:
Gadget wrote:
Derek § wrote:
I used a randomizing algorithm. I based it between 0-1. I divided 1/13, 2/13, 3/13, etc. (there are 13 different possible card values; Ace(1),2,3,4,5,6,7,8,9,10,J,Q,K) to see the decimals I would get. For example, 0-0.077 represents the 2 card. Oh, hold on. I'll just show you the code in a bit, BRB.

A more common, and cleaner approach, is to use random to use the mod operator w/ random to generate values from 0 to 12. Random.getNum() * 1000 % 13 should do the trick.


wouldn't rand.num() * 168 % 13 work better? The should always give a modulus of 0 - 12. or rand.num() 1689 % 130 for better odds calculation.

also, you could have a divide by 0 exception could you not?

Manta

Recursively....

You won't have a division by zero error. 0 % 13 is the remainder when dividing 0 by 13, not 13 / 0. And we can divide zero all day long. :)

However, depending on the card game and how he things setup, there is a potential problem (hint: what's the difference between a permutation and combination?).

Concerning random numbers. You're correct*. If the value range is from 0 to 99 (random * 100), and we use modula 13 to segment it, we are going to have fewer opportunities for the numbers 9-12 to appear. There will be a lower segment that occurs more frequently than the upper segment. You can't really detect that something is wrong in my test code because multiplying by 1000 reduced the chance of the error occuring enough to make it undetectable by most casual methods. If I had multiplied by 20 instead of 1000, and used modula 13, it is very obvious.

*A better and shorter answer: both of our methods suck (yes, yours! see below.) and would probably cause a statistician to either chuckle or cry. :)

Random number generation is a very complex subject within the field of number theory. For example, one of the volumes in the art of computer programming has appx 100 pages devoted to random numbers! The bestWay() method below is based on one of the methods discussed by Knuth in the art of computer programming.

Anyways, it was late when I wrote that and betterWay() or bestWay() is how I would actually do it when thinking like a human and not a chimp. :)

Code:
import java.util.*;

public class RandomNumberTest {
   
    public static int myWay() {
        return (int)(Math.random() * 1000) % 13;
    }
   
    public static int myWay(int i) {
        return (int)(Math.random() * i) % 13;
    }
   
    public static int yourWay() {
        return (int)(Math.random() * 168) % 13;
    }
   
    public static int betterWay() {  // better way, general method
        return (int)(Math.random() * 13);
    }
   
    static Random rand = new Random();
    public static int bestWay() {  //best way in Java, this is based on a linear congruential forumula
        return rand.nextInt(13);
    }
   
    public static void printArray(int[] arr) {
       
        int min = Integer.MAX_VALUE;
        int max = Integer.MIN_VALUE;
       
        for (int i = 0; i < arr.length; i++) {

            if (i % 5 == 0 && i != 0)
                System.out.print("\n" + i + ": " + arr[i] + "\t\t");
            else
                System.out.print(i + ": " + arr[i] + "\t\t");
           
            if (arr[i] < min)
                min = arr[i];
           
            if (arr[i] > max)
                max = arr[i];
        }
       
        System.out.println("\nmin: " + min + "\tmax: " + max + "\tdifference: " + (max - min) + "\n");
    }
   
    public static void main(String[] args) {

        System.out.println("myWay()");
        int[] arr = new int[13];
        for (int i = 0; i < 100000; i++)
            arr[RandomNumberTest.myWay()]++;
        printArray(arr);
       
        System.out.println("yourWay()");
        Arrays.fill(arr,0);
        for (int i = 0; i < 100000; i++)
            arr[RandomNumberTest.yourWay()]++;
        printArray(arr);
       
        System.out.println("betterWay()");
        Arrays.fill(arr,0);
        for (int i = 0; i < 100000; i++)
            arr[RandomNumberTest.betterWay()]++;
        printArray(arr);
       
        System.out.println("bestWay()");
        Arrays.fill(arr,0);
        for (int i = 0; i < 100000; i++)
            arr[RandomNumberTest.bestWay()]++;
        printArray(arr);

        System.out.println("myWay(20)");
        Arrays.fill(arr,0);
        for (int i = 0; i < 100000; i++)
            arr[RandomNumberTest.myWay(20)]++;
        printArray(arr);
       
        System.exit(0);
    }
}


Ok, this is why you run tests. The test program I wrote just counts the number of occurances of each random number then outputs them along with the min, max and difference between the min and max (a VERY casual test, but it helps spot obvious errors). Also, I overloaded myWay() with a version that takes an integer arguement to change the multiplier to any integer. You can clearly see the error when using a small arguement value like 20. Obvious as punch. In fact, if you take the average of elements 0 to 9 in myWay() and compare them to the average of elements 10 to 12, you'll see the same error pretty clearly. Takedown - 2 points Mantabase.

The method you wrote, which I call yourWay(), appears to suffer from the same error. Every time I've run the test, yourWay() not only had the largest difference between the min and max, but the min is always in the element 12. The moral of the story: It is very easy to screw up this random number stuff (even for an uber-noober Python pro-groomer! :P). Escape and takedown - 3 points Gadget.

Code:
myWay()
0: 7634     1: 7767     2: 7572     3: 7790     4: 7655     
5: 7673     6: 7660     7: 7734     8: 7681     9: 7836     
10: 7588        11: 7603        12: 7807       
min: 7572   max: 7836   difference: 264

yourWay()
0: 7792     1: 7781     2: 7673     3: 7732     4: 7795     
5: 7761     6: 7830     7: 7766     8: 7701     9: 7636     
10: 7736        11: 7729        12: 7068       
min: 7068   max: 7830   difference: 762

betterWay()
0: 7820     1: 7560     2: 7773     3: 7583     4: 7755     
5: 7785     6: 7779     7: 7633     8: 7693     9: 7592     
10: 7607        11: 7613        12: 7807       
min: 7560   max: 7820   difference: 260

bestWay()
0: 7707     1: 7753     2: 7719     3: 7738     4: 7655     
5: 7785     6: 7636     7: 7721     8: 7717     9: 7713     
10: 7689        11: 7497        12: 7670       
min: 7497   max: 7785   difference: 288

myWay(20)
0: 9908     1: 9942     2: 9997     3: 10053        4: 9981     
5: 9886     6: 10098        7: 5111     8: 5074     9: 4918     
10: 5011        11: 5072        12: 4949       
min: 4918   max: 10098  difference: 5180


Top
  Profile  
 
 Post subject:
PostPosted: Sun Aug 15, 2004 2:45 pm 
Bitchin' Fast 3D Z8000*
Bitchin' Fast 3D Z8000*
User avatar

Joined: Tue Jun 29, 2004 11:32 pm
Posts: 2555
Location: Somewhere between compilation and linking
Derek § wrote:
Wow, my randomizing code doesn't work when I use it in VB 2005 Express Edition. Wonder why? Maybe I'll go with MantaBase's form. The variable that holds the random values is x, and it's declared as VariantType, vs. in the older one (VB 2003.NET), it wasn't declared at all. Could that have anything to do with it?

NO! Use something like betterWay or bestWay (see above). Manta's version is broken too!

I have no idea wth a variant type is.... Wolfman - these damn vb people are confusing me again! :D

Sly remark....
However, I'm fairly confident it is suppose to help noobs from making one kind of error, but in reality, causes them to make several other errors of which they have no idea. :shock:


Top
  Profile  
 
 Post subject:
PostPosted: Sun Aug 15, 2004 4:05 pm 
I'd rather be modding!
I'd rather be modding!
User avatar

Joined: Fri Jun 25, 2004 3:47 pm
Posts: 3731
Location: Las Vegas
[quote="Gadget"][/quote]


I was working on the assumption that Python uses 8 digit precsion.

IOW:
rand calls a number between 0.00000000 and 1.00000000

I will go back and look at my mistake.

This is a VB issue for a first pass game of 21. If he wanted to make it real he wouldn't be using the stock rand and an infinite deck (he would use a selectable set of 4*13 and not just 13 random cards). If I wanted more random numbers I would use the rand to pull a seed for a more complicated monte carlo based possibly on the sys clock for another seed because a human "hit" is needed to call additional cards (thus a random clock time).

I was just trying to get him modulus numbers that are 0-12.

Do we need to have a RAND competition?

*Gadget shoots....denied - -No wait...there may have been a foul on the play!!*

As for divide by zero, you are right - I wasn't thinking. I was wondering what would happen if I divided by a random real and 0.00000000 came up. That would be a rare find.

I haven't toyed enough to see how python generates rands.

Manta


Top
  Profile  
 
 Post subject:
PostPosted: Sun Aug 15, 2004 4:45 pm 
Bitchin' Fast 3D Z8000*
Bitchin' Fast 3D Z8000*
User avatar

Joined: Tue Jun 29, 2004 11:32 pm
Posts: 2555
Location: Somewhere between compilation and linking
MantaBase wrote:
I will go back and look at my mistake.


You did one of two things....

Bad math....
168 / 13 = 12.92
169 / 13 = 13

OR

Bad programming...
168 / 12 = 14

But good logic. Either, you inadvertantly made the same mistake that you caught in mine (but used a smaller number, 168, so it showed up worse), OR you had an off by one error because of the zero based array index (divded 128 by 12 instead of 13).


Quote:
This is a VB issue for a first pass game of 21. If he wanted to make it real he wouldn't be using the stock rand and an infinite deck (he would use a selectable set of 4*13 and not just 13 random cards).

Bingo. He needs to remove cards from the deck, and from what I've seen, he hasn't taken this into account yet.


Quote:
Do we need to have a RAND competition?

Absolutely!

/me runs off to avoid getting hit by a lunar rock.


Top
  Profile  
 
 Post subject:
PostPosted: Sun Aug 15, 2004 5:00 pm 
I'd rather be modding!
I'd rather be modding!
User avatar

Joined: Fri Jun 25, 2004 3:47 pm
Posts: 3731
Location: Las Vegas
Gadget wrote:
I will go back and look at my mistake.


Bad math....
168 / 13 = 12.92
169 / 13 = 13

OR

Bad programming...
168 / 12 = 14

[/quote]

Arf - bad programming and math - I wasn't thinking, I picked 168 so 13 could not be an answer.

I don't know what I was thinking!!!

It looked right though!

*Thats why JPL pays me the big bucks*

*Gadget get the foul, two points*

Manta


Top
  Profile  
 
 Post subject:
PostPosted: Sun Aug 15, 2004 6:22 pm 
I'd rather be modding!
I'd rather be modding!
User avatar

Joined: Fri Jun 25, 2004 3:47 pm
Posts: 3731
Location: Las Vegas
MantaBase wrote:
Gadget wrote:
I will go back and look at my mistake.


Bad math....
168 / 13 = 12.92
169 / 13 = 13

OR

Bad programming...
168 / 12 = 14



Arf - bad programming and math - I wasn't thinking, I picked 168 so 13 could not be an answer.

I don't know what I was thinking!!!

It looked right though!

*Thats why JPL pays me the big bucks*

*Gadget get the foul, two points*

Manta[/quote]

Dampit you are confusing me...

x= rand()* 1689 %130 always gives a value of 0-12. Thats what I wanted. there is no %120, it always 130 .

The whole point of 168 was to make sure you never have a mod of 13, just 0-12. Using 1689 does the same but is better than 1000 like you proposed.

Test that Gadget!!

What am I missing???

Manta


Top
  Profile  
 
 Post subject:
PostPosted: Sun Aug 15, 2004 11:09 pm 
Bitchin' Fast 3D Z8000*
Bitchin' Fast 3D Z8000*
User avatar

Joined: Tue Jun 29, 2004 11:32 pm
Posts: 2555
Location: Somewhere between compilation and linking
MantaBase wrote:
Dampit you are confusing me...

x= rand()* 1689 %130 always gives a value of 0-12. Thats what I wanted. there is no %120, it always 130 .

The whole point of 168 was to make sure you never have a mod of 13, just 0-12. Using 1689 does the same but is better than 1000 like you proposed.

Test that Gadget!!

What am I missing???

Manta

LMAO!!! :D

You remind me of someone in their first programming contest. Oh this is going to be easy. Hmm... why didn't that work. Let me double check.... THAT SHOULD WORK! Hey, is this computer bro... oh, wait, that's it. Nope. Damn it. OMG, those guys from Cal Tech are finished! HTF did that happen! :)

Let's step back to a general solution.....

x % y = ?

for positive values of x and y,
if (x >= y) it will equal something between 0 and y-1
if (x < y) it will be x, which is the same thing... a number between 0 and y-1

From a programmers point of view, if you need a range starting from 0, you just pick a value of y that is 1 larger than than the max that you want for the range.

Quote:
x= rand()* 1689 %130 always gives a value of 0-12. Thats what I wanted. there is no %120, it always 130 .

Let's break it down.... rand() * 1689 is going to be a value between 0 and 1688.99999999... right? What if it is 120? 120 % 130 = 120.

The method that I proposed is messy - hell, I even screwed it up as you correctly pointed out. Use the method in betterWay(). rand() * 13 will give you a value somewhere from 0 to 12.9999999.... when this is caste to an int, the decimal component is dropped and you have left a value of 0 to 12.

Here is the test case:

Code:
import java.util.*;

public class RandomNumberTest {
   
    public static int newWay() {
        return (int)(Math.random() * 1689) % 130;
    }
   
    public static int betterWay() {  // better way, general method
        return (int)(Math.random() * 13);
    }
   
    public static void printArray(int[] arr) {
       
        int min = Integer.MAX_VALUE;
        int max = Integer.MIN_VALUE;
       
        for (int i = 0; i < arr.length; i++) {
           
            if (i % 5 == 0 && i != 0)
                System.out.print("\n" + i + ": " + arr[i] + "\t\t");
            else
                System.out.print(i + ": " + arr[i] + "\t\t");
           
            if (arr[i] < min)
                min = arr[i];
           
            if (arr[i] > max)
                max = arr[i];
        }
       
        System.out.println("\nmin: " + min + "\tmax: " + max + "\tdifference: " + (max - min) + "\n");
    }
   
    public static void main(String[] args) {
       
        int[] arr = new int[13];

        try {
            System.out.println("newWay()");
            Arrays.fill(arr,0);
            for (int i = 0; i < 100000; i++)
                arr[RandomNumberTest.newWay()]++;

            printArray(arr);
        }
       
        catch(ArrayIndexOutOfBoundsException e) {
            System.err.println("Oh no!  :)");
            e.getMessage();
            e.printStackTrace();
        }
       
        System.exit(0);
    }
}


Code:
newWay()
Oh no!  :)
java.lang.ArrayIndexOutOfBoundsException: 25
    at RandomNumberTest.main(RandomNumberTest.java:90)


newWay() returned a value of 25 casuing the exception. The line numbering is off (line :90) because I removed the old code from the posting.


Top
  Profile  
 
 Post subject:
PostPosted: Mon Aug 16, 2004 7:35 am 
I'd rather be modding!
I'd rather be modding!
User avatar

Joined: Fri Jun 25, 2004 3:47 pm
Posts: 3731
Location: Las Vegas
Ok I see the 1690 part and the 12.999999 result.

Does VB not have something like random.shuffle(list) ??

That would seem easier to me. just shuffle the deck(s) and move through an index each time a card is played

look at the while loop I used at the end of my cheese program.

Manta


Top
  Profile  
 
 Post subject:
PostPosted: Mon Aug 16, 2004 9:21 am 
8086
8086

Joined: Mon Jul 26, 2004 8:40 am
Posts: 55
Location: Illinois, in the U.S. of A.
Wow! You guys are getting out of control! lol. I've just taken VB 6 at High School last year, so I'm not by any means an experienced programmer.

In VB.NET, if I'm not mistaken, randomize is already supposed to be based on the system clock.


Top
  Profile  
 
 Post subject:
PostPosted: Mon Aug 16, 2004 10:06 am 
Bitchin' Fast 3D Z8000
Bitchin' Fast 3D Z8000
User avatar

Joined: Sat Jun 26, 2004 3:44 pm
Posts: 513
Location: Vancouver Island
Derek § wrote:
Wow! You guys are getting out of control! lol. I've just taken VB 6 at High School last year, so I'm not by any means an experienced programmer.

In VB.NET, if I'm not mistaken, randomize is already supposed to be based on the system clock.


Don't worry...this is how the guys in the lab coats with the pocket protector's that are relegated to working in cubicles with headphones compare cock size...you'll be there one day too. heh,heh. ;-)


Top
  Profile  
 
 Post subject:
PostPosted: Mon Aug 16, 2004 10:50 am 
I'd rather be modding!
I'd rather be modding!
User avatar

Joined: Fri Jun 25, 2004 3:47 pm
Posts: 3731
Location: Las Vegas
Derek § wrote:
Wow! You guys are getting out of control! lol. I've just taken VB 6 at High School last year, so I'm not by any means an experienced programmer.

In VB.NET, if I'm not mistaken, randomize is already supposed to be based on the system clock.


Thats probably true - but because you are calling the numbers in a cyclical fasion they are not as random as they could be. If you check the closk based on a users input as well, its a bit more random. I wouldn't worry to much about it for what you are doing.

In some languages, you can use the random function to shuffle a list. In python its something like Card[1] = random.shuffle("list of cards") (don't trust my syntax).

In a sense, the "list of cards" is your deck of cards. Card[1] (actually, its 0 not 1) is the card on the top of the deck. If VB has that, its a better way to go IMO. You might look at the random function docs a bit closer for VB. Maybe you can't do it - but if you can it will save you a bit of time and look much nicer :)

Manta


Top
  Profile  
 
Display posts from previous:  Sort by  
Post new topic Reply to topic  [ 64 posts ]  Go to page 1, 2, 3, 4  Next

All times are UTC - 8 hours


Who is online

Users browsing this forum: No registered users and 3 guests


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot post attachments in this forum

Search for:
Jump to:  
Powered by phpBB © 2000, 2002, 2005, 2007 phpBB Group

© 2014 Future US, Inc. All rights reserved.