You signed in with another tab or window. Reload to refresh your session. You signed out in another tab or window. Reload to refresh your session. You switched accounts on another tab or window. Reload to refresh your session. Dismiss alert
This domain may be for sale!
みんなのIoT/みんなのPythonの著者。二子玉近く160平米の庭付き一戸建てに嫁/息子/娘/わんこと暮らしてます。月間1000万PV/150万UUのWebサービス運営中。 免責事項 プライバシーポリシー stackoverflowで見つけた乱数に関する質問「乱数のランダムさって?」に対する解答が面白かったので紹介します。 乱数のランダムさというのは,沢山標本をとったときに,標本値がまんべんなく均等に分布する,ということ。プログラミング言語などに組み込まれた乱数を発生する仕組みが返す値が均等に分布してないと,テトリスでなかなか長い棒が落っこちてこなかったりするわけです。 数学的な詳細はともかく,こういう知識はプログラミングをする上で知って置いた方がよいと思います。 さて,質問の内容は random()とrandom()×random()のどっちがランダムなの? というもの。後者はrand
このエントリはScala Advent Calendar jp 2010 : ATNDの25日のものです。 メリークリスマス! クリスマスは楽しくみんなでパズルを解いて遊びましょう。 パズルみたいな探索問題をScalaで解く場合は、リストモナドを使うとキレイに書けます。 例: SEND+MORE=MONEY 例として覆面算を解いてみましょう。 各アルファベットに異なる数字が割り当てれる。その数字は何か? ただし最上位桁が0ではない。 普通にforループを使って解くと、ネストの深さが酷いことになります:)。 // int(1,2,3)を123にする関数 def int(xs : Int*) : Int = xs.foldLeft(0)( _ * 10 + _) // SEND+MORE=MONEYの答えを探索する def solve : (Int,Int,Int) = { for( s <-
リリース、障害情報などのサービスのお知らせ
最新の人気エントリーの配信
処理を実行中です
j次のブックマーク
k前のブックマーク
lあとで読む
eコメント一覧を開く
oページを開く