選りすぐったそば粉に、三重の気候風土に育まれた純県内産小麦と多気町産伊勢いもを、つなぎとしてこだわりました。ヤマノイモ科の伊勢いもは、粘りが強くアミラーゼ等を含んで、地元では貴重な食品として人気があります。滑らかで芳醇な伊勢いもの風味と、そばとの絶妙な味わいをお楽しみ下さい。とのこと。
#!/usr/bin/perl use strict; use warnings; my $rank = shift || 1000; my $sum; my @sums; for (my $i = 0; $i < $rank; $i++) { $sum += 1/($i+1); $sums[$i] = $sum; } while (1) { my $value = rand() * $sum; my $idx = bsearch($value); print $idx+1,"\n"; } sub bsearch { my ($value) = @_; my $head = 0; my $tail = $rank - 1; while ($head <= $tail) { my $where = int(($head + $tail) / 2); if ($value <= $sums[$where]) { $tail = $where - 1; } else { $head = $where + 1; } } return $head; }
% ./zipf-gen.pl | head 438 333 859 48 180 27 200 64 572 1 % ./zipf-gen.pl | head -10000 | sort -n | uniq -c | head -20 1355 1 666 2 406 3 341 4 290 5 250 6 189 7 156 8 152 9 123 10 110 11 111 12 128 13 96 14 110 15 90 16 86 17 71 18 80 19 66 20
#!/usr/bin/perl use strict; use warnings; while (1) { my $id = 1; $id++ while rand() < 0.5; print "$id\n"; }
% ./nise-zipf-gen.pl | head 2 2 1 1 4 1 1 2 1 2 % ./zipf-gen.pl | head -10000 | sort -n | uniq -c 4978 1 2513 2 1221 3 647 4 317 5 161 6 84 7 34 8 19 9 9 10 8 11 3 12 4 14 2 15