虫言虫语 虫言虫语

题目数量和分值固定的情况下抽取不同分值题型分布

in PHPread (322809) 文章转载请注明来源!
 public function sum()
{
    $sum = 0;
    $arr = array();

// 最大分值

    $max=6;

// 最小分值

    $min=1;

// 总分

    $sum_n = 40;

// 题目数量

    $n=10;
    for ($i=1;$i<$max+1;$i++){
        $list[$i]=0;
    }
    $i = 1;
    while ($i <=$n) {
        $a = rand($min, $max);
            if (($sum_n-$sum-$a)>=$min*($n-$i) && ($sum_n-$sum-$a)<=$max*($n-$i)) {
                $sum = $sum + $a;
                $list[$a]=$list[$a]+1;
                $arr[] = $a;
                $i++;
            }
    }
    $ss = 0;
    foreach ($arr as $a) {
        $ss = $ss + $a;
    }
    var_dump($list);
    var_dump($ss);
    dd($arr);
}
jrotty WeChat Pay

微信打赏

jrotty Alipay

支付宝打赏

文章二维码

扫描二维码,在手机上阅读!

PHP
发表新评论
已有 40120 条评论
  1. cializS
    cializS
    回复

    cialis 20 mg cost best prices on cialis generic

  2. canadian pharcharmy online

    mail order prescription drugs from canada
    http://canadiannextpharmacy.com/
    top 10 online pharmacies

  3. JamesEsorn
    JamesEsorn
    回复

    generic viagra without a doctor prescription meds without a doctor prescription
    buy ed drugs http://genericvgrshop.com buy prescription viagra
    buy viagra very cheap buy prescription viagra

  4. cializS
    cializS
    回复

    buy cialis in miami cialis liquid dose

  5. cializS
    cializS
    回复

    where can u buy cialis does medco pay for cialis

  6. ed meds online without doctor prescription

    canadian pharmacy
    http://canadian2pharmacy.com/

  7. AhmdSkype
    AhmdSkype
    回复

    36 hour cialis mg cialis shelf life cialis w/dapoxetine http://cialmenshoprx.com/ - generic cialis pay pal ’

  8. cializS
    cializS
    回复

    cialis online without prescription cialis dosis correcta

  9. A Payday Loan
    A Payday Loan
    回复

    payday loans in denver unsecured loans for bad credit payday loan no faxing best personal loans companies online loans no credit payday advance online get cash now loans loans for poor credit

  10. MiaDes
    MiaDes
    回复

    online sildenafil india hydrochlorothiazide 25 mg coupon acyclovir 200mg capsules metformin medicine where can i get cialis online

  11. cialifS
    cialifS
    回复

    how to buy cialis online from canada cialis czechy

  12. MiaDes
    MiaDes
    回复

    generic zyban synthroid generic maquine price of zithromax buy lyrica online india

  13. KimDes
    KimDes
    回复

    how to order cialis

  14. JamesEsorn
    JamesEsorn
    回复

    buy medication without an rx buying prescription viagra from canada
    male enhancement products http://genericvgrshop.com buy generic viagra
    meds without a doctor prescription buying prescription viagra from canada

  15. cookingpost
    cookingpost
    回复

    домашние рецепты
    рецепты
    рецепты салатов
    домашние рецепты
    пошаговые рецептыcookingwrw31
    рецепт теста
    рецепт теста
    второе блюдо
    рецепты салатов
    Кулинария

  16. canadian online pharmacies legitimate

    pharmacy drugstore online
    http://canadiannextpharmacy.com/
    best canadian mail order pharmacies

  17. best mexican online pharmacies

    reputable canadian online pharmacies
    http://canadiannextpharmacy.com/
    canada online pharmacy

  18. NickDes
    NickDes
    回复

    thecanadianpharmacy metformin without a prescriptions online wellbutrin prescription uk amoxicillin over the counter australia

  19. FmfvSkype
    FmfvSkype
    回复

    brand cialis in the us brand cialis how can i get cheaper cialis http://sjcialis.com/ - cialis generika china ’

  20. KimDes
    KimDes
    回复

    viagra order online usa

博客已萌萌哒运行
© 2021 由 Typecho 强力驱动.Theme by Yodu
前篇 后篇
雷姆
拉姆