Repository navigation
Update RedPacket.java - #119
Open
shaaoteiman wants to merge 2 commits into
Open
shaaoteiman wants to merge 2 commits into
shaaoteiman wants to merge 2 commits into
Conversation
修改随机红包产生规则
crossoverJie
self-requested a review
November 1, 2018 06:46
Owner
|
请描述下调整的原因。 |
Author
|
通过debug发现,发现(int) (Math.random() * (maxMoney - minMoney) + minMoney)这段代码,在minMoney为19999的时候,由于maxMoney等于200*100,那么这段代码的结果恒为19999,所以带入参数(40000,2)的情况下导致剩余的那个红包一直等于20001 |
补齐变量定义
crossoverJie
reviewed
Dec 1, 2018
| */ | ||
| private static final double TIMES = 2.1F; | ||
|
|
||
| //变量定义 |
| if (MAX_MONEY * count <= money) { | ||
| System.err.println("请调大最小红包金额 MAX_MONEY=[" + MAX_MONEY + "]"); | ||
| return moneys ; | ||
| //金额检查,如果最大红包 * 个数 < 总金额或最小红包 * 个数 > 总金额;则需要调整红包总金额 |
Owner
There was a problem hiding this comment.
这里没必要抛异常了,像以前直接打印也没问题。不然所有的单测都需要改。
Repository owner
deleted a comment from
yjw0513
Jan 4, 2019
This branch has not been deployed
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
修改随机红包产生规则