Results 1 to 4 of 4

Math Help - q:uniform distributed mapping func

  1. #1
    Newbie
    Joined
    Jun 2012
    From
    il
    Posts
    2

    Talking q:uniform distributed mapping func

    hi all,
    need some guidance
    how can i produce a uniform distributed mapping function, from integers(let's assume less than 2^31) to integers between 0..n?

    help would be appreciated!
    Follow Math Help Forum on Facebook and Google+

  2. #2
    mfb
    mfb is offline
    Junior Member
    Joined
    Jun 2012
    From
    Germany
    Posts
    72
    Thanks
    5

    Re: q:uniform distributed mapping func

    There is no general way to uniformly map all integers from 0 to m to the set 0...n unless (n+1) is a divisor of (m+1). In this case, just take the number mod (n+1).
    However, you can do the following: Determine the largest k such that k*(n+1)<=m. If the random number is <k*(n+1), use this number mod (n+1), otherwise get a new random number.
    This is not the most efficient way to use your source of randomness, but for small n the difference is negligible.
    Follow Math Help Forum on Facebook and Google+

  3. #3
    Super Member
    Joined
    Mar 2008
    Posts
    934
    Thanks
    33
    Awards
    1

    Re: q:uniform distributed mapping func

    Quote Originally Posted by dooms View Post
    hi all,
    need some guidance
    how can i produce a uniform distributed mapping function, from integers(let's assume less than 2^31) to integers between 0..n?

    help would be appreciated!
    Maybe just try reducing the integer modulo n+1.
    Follow Math Help Forum on Facebook and Google+

  4. #4
    Newbie
    Joined
    Jun 2012
    From
    il
    Posts
    2

    Re: q:uniform distributed mapping func

    yes! that was a dumb question by me. nothing's really random.

    % n+1 will do.

    sweet, thanks.
    Follow Math Help Forum on Facebook and Google+

Similar Math Help Forum Discussions

  1. Complex open mapping & conformal mapping problems.
    Posted in the Differential Geometry Forum
    Replies: 1
    Last Post: February 22nd 2011, 07:26 AM
  2. Replies: 1
    Last Post: October 31st 2010, 07:09 PM
  3. exp func
    Posted in the Algebra Forum
    Replies: 1
    Last Post: August 24th 2009, 06:43 PM
  4. Replies: 2
    Last Post: April 22nd 2009, 01:49 AM
  5. Fam. of func.
    Posted in the Calculus Forum
    Replies: 2
    Last Post: March 27th 2008, 04:56 PM

Search Tags


/mathhelpforum @mathhelpforum