Welcome to Discuss Everything Forums...

If this is your first visit, be sure to check out the FAQ by clicking the link above. You may have to register before you can post: click the register link above to proceed.


 

Reply to Thread

Post a reply to the thread: VB.Net - Random integers turning into random floats? why?

Your Message

Click here to log in

What comes after M0nday

 
 

You may choose an icon for your message from this list

Additional Options

  • Will turn www.example.com into [URL]http://www.example.com[/URL].

Rate Thread

You may rate this thread from 1-star (Terrible) to 5-stars (Excellent) if you wish to do so.

Topic Review (Newest First)

  • 11-20-2012, 09:30 AM
    Kresimir

    VB.Net - Random integers turning into random floats? why?

    Sub randomsub(ByRef num, ByVal max)
    num = Rnd() * max
    End Sub

    That is my code, both num and max are integers.
    Before it worked fine, but then I added an extra option to choose between additoon/subtraction/multiplication and i copied and pasted and changed the operator( + - x).

    I want it to only randomize full integers not decimal point floats.

    WHY IS IT GIVING ME THIS STUFF NOW?
    http://img266.imageshack.us/img266/1913/rgesawfew.jpg
    well this is in vb.net, not psuedocode, also max is defined as an integer same as num because i want they to be integers. I can easily change max to tempnum and it makes no difference.
    FIXED!
    Its okay... i just reverted back to my old programming style and made everything a global and for SOME WEIRD REASON it works...

Posting Permissions

  • You may post new threads
  • You may post replies
  • You may not post attachments
  • You may not edit your posts
  •