Android Open Source - XKCD-Reader Math Util






From Project

Back to project page XKCD-Reader.

License

The source code is released under:

Apache License

If you think the Android project XKCD-Reader listed in this page is inappropriate, such as containing malicious code/tools or violating the copyright, please email info at java2s dot com, thanks.

Java Source Code

package com.davidtpate.xkcd.util;
/*  w  w w  .  j av a 2 s  .c o  m*/
import java.util.Random;

public class MathUtil {
    private static final Random mRandom = new Random();
    /**
     * Returns a pseudo-random number between min and max, inclusive.
     * The difference between min and max can be at most
     * <code>Integer.MAX_VALUE - 1</code>.
     *
     * See http://stackoverflow.com/a/363692/1076683 for details.
     *
     * @param min Minimum value
     * @param max Maximum value.  Must be greater than min.
     * @return Integer between min and max, inclusive.
     * @see java.util.Random#nextInt(int)
     */
    public static int randInt(int min, int max) {
        // nextInt is normally exclusive of the top value,
        // so add 1 to make it inclusive
        int randomNum = mRandom.nextInt((max - min) + 1) + min;

        return randomNum;
    }
}




Java Source Code List

android.support.v4.app.FixedFragmentStatePagerAdapter.java
com.android.debug.hv.ViewServer.java
com.davidtpate.xkcd.BaseApplication.java
com.davidtpate.xkcd.adapter.ComicPagerAdapter.java
com.davidtpate.xkcd.model.Comic.java
com.davidtpate.xkcd.model.Constants.java
com.davidtpate.xkcd.preferences.SharedPreferencesHelper.java
com.davidtpate.xkcd.provider.SystemUiStateProvider.java
com.davidtpate.xkcd.ui.About.java
com.davidtpate.xkcd.ui.ComicFragmentActivity.java
com.davidtpate.xkcd.ui.ComicFragment.java
com.davidtpate.xkcd.ui.CurrentComic.java
com.davidtpate.xkcd.ui.base.BaseActivity.java
com.davidtpate.xkcd.ui.base.BaseFragmentActivity.java
com.davidtpate.xkcd.ui.base.BaseFragment.java
com.davidtpate.xkcd.ui.base.BaseListActivity.java
com.davidtpate.xkcd.ui.base.BaseListFragment.java
com.davidtpate.xkcd.ui.dialog.JumpToDialogFragment.java
com.davidtpate.xkcd.util.AndroidUtil.java
com.davidtpate.xkcd.util.ComicUtil.java
com.davidtpate.xkcd.util.Ln.java
com.davidtpate.xkcd.util.MathUtil.java
com.davidtpate.xkcd.util.Strings.java