Results 1 to 3 of 3

Thread: Math.Random()

  1. #1

    Thread Starter
    Hyperactive Member Stiletto's Avatar
    Join Date
    Aug 2002
    Location
    Jerusalem, Israel
    Posts
    287

    Question Math.Random()

    Hello,
    Can Math.Random randomize a number with two zeros after the decimal point?
    I want a 4 digits number (integer) and would like to check the option of, for example, 0.0012... since i multiply the randomized number by 10000.
    Thanks

  2. #2
    Arabic Poster ComputerJy's Avatar
    Join Date
    Nov 2005
    Location
    Happily misplaced
    Posts
    2,513

    Re: Math.Random()

    Math.random method returns a double between 0 and 1 no more specifications!
    "I'm not normally a praying man, but if you're up there, save me... Superman!" - Homer Simpson
    My Blog

  3. #3
    Super Moderator manavo11's Avatar
    Join Date
    Nov 2002
    Location
    Around the corner from si_the_geek
    Posts
    7,171

    Re: Math.Random()

    If you divide the random number that is returned by 100, then it would guarantee you that you have two zeros after the decimal point. Or I've missed something


    Has someone helped you? Then you can Rate their helpful post.

Posting Permissions

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



Click Here to Expand Forum to Full Width