提供一个红包算法,随手写的,还有很多需要优化的地方,但是效率比较高,
测试效率:一百万次 ,20 个红包的 需要 1.3 秒左右
一百万次 ,100 个红包的 需要 6.3 秒左右
代码实现:
百万次 ,20 个的 红包 。 1.3 秒
百万次 100 个的 红包 6.3 秒
百万次 10 个 红包。0.7 秒
提供一个红包算法,随手写的,还有很多需要优化的地方,但是效率比较高,
测试效率:一百万次 ,20 个红包的 需要 1.3 秒左右
一百万次 ,100 个红包的 需要 6.3 秒左右
代码实现:
百万次 ,20 个的 红包 。 1.3 秒
百万次 100 个的 红包 6.3 秒
百万次 10 个 红包。0.7 秒