大賞數字是從第一位開始給予,直到大賞數量給完為止
// PHP 程式碼
// 輸入大賞hash值
$txid = '799746d145f88f3d5514b40844e076cf..............';
// 總共幾個大賞
$prize_count = 13;
// 總共幾個籤數
$tag_count = 350;
$dec = gmp_init($txid, 16);
$prize_tmp = [];
$prize_tmp_count = 0;
$step_tmp = 100;
$step = 1;
$max_count = 100;
try {
while ($step <= $max_count) {
$powResult = gmp_pow($step_tmp, $step);
$div = gmp_div_q($dec, $powResult);
$mod = gmp_mod($div, $tag_count);
$prize_number = (int)gmp_strval($mod) + 1;
if (!in_array($prize_number, $prize_tmp)) {
$prize_tmp[] = $prize_number;
$prize_tmp_count++;
}
if ($prize_tmp_count >= $prize_count) {
break;
}
$step++;
}
echo implode(', ', $prize_tmp);
} catch (\Exception $e) {
echo $e->getMessage();
}
// PHP 程式碼
// 輸入偏移量hash值
$txid = "f141ffe8c85ebcc6448d17751897d6272bda9e2.......";
// 輸入預計算的原本獎號
$number = 500;
// 預設偏移量為 0-255
$shift_offset = 255;
// 總共幾個籤數
$tag_count = 510;
$dec = gmp_init($txid, 16);
$mod = gmp_mod($dec, $shift_offset);
$shift_number = (int)gmp_strval($mod) + $number;
if ($shift_number > $tag_count) {
$shift_number = $shift_number % $tag_count;
if ($shift_number == 0) {
$shift_number = $tag_count;
}
}
echo $shift_number;