PHP生成信用卡还款计划源码

180it 2019-11-03 PM 1608℃ 0条

<?php

$num_zong = 1000;

$key = array();

    $num31 = intval($num_zong*0.56);//3+1总数

    $mun1 = intval($num31*0.44);//+1总数
    $num3b = $num31-$mun1;
    $mun25 = $num_zong-$num31;

    $num3_1 = intval($num3b*0.25);
    $num3_2 = intval($num3b*0.35);
    $num3_3 = $num3b - $num3_1 - $num3_2;

    $munstr = 0;

    for ($i = 1; $i <= 25; $i++) {
        $sjs = mt_rand('100','800');
        if(($munstr+$sjs)<($num_zong-$num31)){
            $key[] = $sjs;
            $munstr=$munstr+$sjs;
        }

        if (($munstr+$sjs)>($num_zong-$num31)) {
            $sjs = $num_zong-$num31-$munstr;
            $key[] = $sjs;
            $munstr=$munstr+$sjs;
            break;

        }

    }
    $msg = "我的算法是一笔大额,三笔中额,剩下的生成100~800之间的N个随机数为小额:\n\n1笔大额(共$mun1):\n".$mun1."\n\n3笔中额(共".$num3b."):\n".$num3_1."\n".$num3_2."\n".$num3_3."\n\n".count($key)."笔小额(共$mun25):\n".implode ("\n",$key);
    ECHO $msg;
支付宝打赏支付宝打赏 微信打赏微信打赏

如果文章或资源对您有帮助,欢迎打赏作者。一路走来,感谢有您!

标签: none

PHP生成信用卡还款计划源码