Jump to content


 


Register a free account to unlock additional features at BleepingComputer.com
Welcome to BleepingComputer, a free community where people like yourself come together to discuss and learn how to use their computers. Using the site is easy and fun. As a guest, you can browse and view the various discussions in the forums, but can not create a new topic or reply to an existing one unless you are logged in. Other benefits of registering an account are subscribing to topics and forums, creating a blog, and having no ads shown anywhere on the site.


Click here to Register a free account now! or read our Welcome Guide to learn how to use this site.

Photo

Randomization In Vb 2008 Express Edition


  • Please log in to reply
11 replies to this topic

#1 Wolfy87

Wolfy87

  • Members
  • 414 posts
  • OFFLINE
  •  
  • Gender:Male
  • Location:England
  • Local time:05:35 AM

Posted 14 August 2008 - 02:08 PM

I am making a virtual gun range were the wind Dir and Speed vary (Forward Left Right Backward Wind) (0,1,5 mph Speed) So i need to randomize between them which inturn selects different types of offet curser and you have to compensate for it so can anyone help????? :thumbsup:

BC AdBot (Login to Remove)

 


#2 Wolfy87

Wolfy87
  • Topic Starter

  • Members
  • 414 posts
  • OFFLINE
  •  
  • Gender:Male
  • Location:England
  • Local time:05:35 AM

Posted 14 August 2008 - 02:54 PM

Also How would i go about puting in a timer and a score counter i.e Miss = +0, Outer Rim = +1 and Inner Rim = +2? Thanks, Ollie :thumbsup:

#3 groovicus

groovicus

  • Security Colleague
  • 9,963 posts
  • OFFLINE
  •  
  • Gender:Male
  • Location:Centerville, SD
  • Local time:11:35 PM

Posted 14 August 2008 - 04:57 PM

What language are you using, c#, c++..??

#4 Wolfy87

Wolfy87
  • Topic Starter

  • Members
  • 414 posts
  • OFFLINE
  •  
  • Gender:Male
  • Location:England
  • Local time:05:35 AM

Posted 14 August 2008 - 05:08 PM

ok now im typeing on my psp coz i had to come off my computer (sniff sniff:'(...) lol. anyway, forget about the timer and score bit coz i worked that one out my self :thumbsup: but i still need to know how to randomize the wind dir and speed. i will gladly send you the finished program (if i can work out how -.-) if you or any one can help. actually is there anyway of putting it as a download in this forum poast coz i could do that when its done :flowers:. Btw im 14...just thought id say lol. Thanks, Ollie

#5 Wolfy87

Wolfy87
  • Topic Starter

  • Members
  • 414 posts
  • OFFLINE
  •  
  • Gender:Male
  • Location:England
  • Local time:05:35 AM

Posted 14 August 2008 - 05:10 PM

What language are you using, c#, c++..??

I think it is C#

#6 Wolfy87

Wolfy87
  • Topic Starter

  • Members
  • 414 posts
  • OFFLINE
  •  
  • Gender:Male
  • Location:England
  • Local time:05:35 AM

Posted 14 August 2008 - 05:25 PM

i just checked and it said Visual Basic and then underneath it had Visual C# and Visual C++ so im sorta confused

#7 Wolfy87

Wolfy87
  • Topic Starter

  • Members
  • 414 posts
  • OFFLINE
  •  
  • Gender:Male
  • Location:England
  • Local time:05:35 AM

Posted 14 August 2008 - 05:30 PM

but the 2 C's wer seperate downlnads to the visual basic download. and sorry about spamming this forum -.-

#8 groovicus

groovicus

  • Security Colleague
  • 9,963 posts
  • OFFLINE
  •  
  • Gender:Male
  • Location:Centerville, SD
  • Local time:11:35 PM

Posted 14 August 2008 - 05:37 PM

There is an edit button that you could use instead of making multiple posts.

All programming languages have functions of one sort or another for generating random numbers. In your first case, wind direction, you want to generate a random number from 1 to 5, (or 0 to 4, whichever). Which ever number comes up will then correspond to a wind direction. Wind speed can be randomized the same way.

C#
C++

#9 Wolfy87

Wolfy87
  • Topic Starter

  • Members
  • 414 posts
  • OFFLINE
  •  
  • Gender:Male
  • Location:England
  • Local time:05:35 AM

Posted 14 August 2008 - 05:50 PM

Ah...i see, by corrosponding a number to a image and using something like the PickOne function i can make it choose one at random. Also after compairing both of your links i have realised that i am definately using C#. Thank you.

Edited by Wolfy87, 14 August 2008 - 06:05 PM.


#10 Wolfy87

Wolfy87
  • Topic Starter

  • Members
  • 414 posts
  • OFFLINE
  •  
  • Gender:Male
  • Location:England
  • Local time:05:35 AM

Posted 14 August 2008 - 06:21 PM

could you do an example snippet just to get me going?

#11 groovicus

groovicus

  • Security Colleague
  • 9,963 posts
  • OFFLINE
  •  
  • Gender:Male
  • Location:Centerville, SD
  • Local time:11:35 PM

Posted 14 August 2008 - 06:34 PM

Those two links I gave you have exactly the code you need. We don't write code for others, but we are happy to help you with your code once you have given it a try. Once you generate your random number, then you just need to use some if-statements to evaluate what is going to happen. For example, if randNum=0, then windspeed = 0;

#12 Wolfy87

Wolfy87
  • Topic Starter

  • Members
  • 414 posts
  • OFFLINE
  •  
  • Gender:Male
  • Location:England
  • Local time:05:35 AM

Posted 14 August 2008 - 06:40 PM

Thank you so much but im stuck on a few more things, how do i assign curcers manually i.e,

Private

PictureBox2.Curcer = (c:Desktop\Programming\Projects\VRange\0,C.cur...
is it that simple or am entierly wrong?

And also, I tryed the code that you provided for C# and i just cannot get it to work what am i doing wrong i put what it said but it just underligned everything with blue??? and it dose not recognise the command "Random"...:S I rely dont have a clue how to implement it, sorry.

Edited by Wolfy87, 15 August 2008 - 01:50 PM.





0 user(s) are reading this topic

0 members, 0 guests, 0 anonymous users