maoruibin / maoruibin/maoruibin.github.com

生成指定区间的随机整数

Open
#20 0 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

generate
Dominant language
HTML
Stars
22
Forks
4
PR merge metrics
No merged PRs in 30d

Description

  /**
     * Simple function for getting a random range.
     *
     * @param min The minimum int.
     * @param max The maximum int.
     * @return The random value.
     */
    public static int randRange(int min, int max) {
        int mod = max - min;
        double val = Math.ceil(Math.random() * 1000000) % mod;
        return (int) val + min;
    }

Contributor guide

No contributing guide indexed for this repository

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start by searching the repository for randRange or the Java snippet, since the issue names no file or test. Clarify whether the requested interval includes both min and max, then add or update the relevant implementation and tests so the returned values consistently satisfy that range.

Written by the indexing model from the issue text.

Assessment

Tech stack
java
Domain
tooling
Issue type
Feature
Difficulty
2/5
Estimated time
1-3 hours
Activity status
Stale
Clarity
Needs clarification
Newbie friendliness
25/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.