# HG changeset patch # User Robert McIntyre # Date 1342713399 18000 # Node ID 7240d7a5f959ed0a3fd42044472c8e2eb4ccf256 # Parent b4395ca99822f27c55c3af351ca0ccbb9a9d9550 random files :) diff -r b4395ca99822 -r 7240d7a5f959 src/rlm/crypt_addition.clj --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/src/rlm/crypt_addition.clj Thu Jul 19 10:56:39 2012 -0500 @@ -0,0 +1,10 @@ +(ns rlm.crypt-addition) + + +(defn symbol-crypt + [syms-1 syms-2 resuts] + + + + + ) \ No newline at end of file diff -r b4395ca99822 -r 7240d7a5f959 src/rlm/jen.clj --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/src/rlm/jen.clj Thu Jul 19 10:56:39 2012 -0500 @@ -0,0 +1,136 @@ +(ns rlm.jen) + +(defn select-cells [n total-groups] + (map (fn [_] (int (* total-groups (Math/random)))) (range n))) + +(defn all-selected? [selections n] + (= n (count (set selections)))) + +(defn probability-of-all-selected + [n desired total-groups total-trials] + (let [trials + (map (fn [_] + (all-selected? + (select-cells n total-groups) desired)) + (range total-trials)) + prob + (/ (count (filter identity trials)) total-trials)] + prob)) + +(defn your-problem [up-to trials-per-test] + (print "selections probability of getting all 15\n") + (dorun + (map + (fn [n] + (let [prob + (probability-of-all-selected + n 15 15 trials-per-test)] + (printf "%10d %1.3f\n" n (float prob)))) + (range up-to)))) + + +;; rlm.jen> (your-problem 100 1000) +;; selections probability of getting all 15 +;; 0 0.000 +;; 1 0.000 +;; 2 0.000 +;; 3 0.000 +;; 4 0.000 +;; 5 0.000 +;; 6 0.000 +;; 7 0.000 +;; 8 0.000 +;; 9 0.000 +;; 10 0.000 +;; 11 0.000 +;; 12 0.000 +;; 13 0.000 +;; 14 0.000 +;; 15 0.000 +;; 16 0.000 +;; 17 0.000 +;; 18 0.001 +;; 19 0.000 +;; 20 0.001 +;; 21 0.004 +;; 22 0.005 +;; 23 0.012 +;; 24 0.008 +;; 25 0.028 +;; 26 0.031 +;; 27 0.049 +;; 28 0.045 +;; 29 0.056 +;; 30 0.100 +;; 31 0.113 +;; 32 0.125 +;; 33 0.159 +;; 34 0.152 +;; 35 0.203 +;; 36 0.216 +;; 37 0.259 +;; 38 0.285 +;; 39 0.283 +;; 40 0.331 +;; 41 0.371 +;; 42 0.420 +;; 43 0.421 +;; 44 0.456 +;; 45 0.491 +;; 46 0.527 +;; 47 0.558 +;; 48 0.534 +;; 49 0.568 +;; 50 0.580 +;; 51 0.605 +;; 52 0.668 +;; 53 0.676 +;; 54 0.678 +;; 55 0.706 +;; 56 0.726 +;; 57 0.732 +;; 58 0.743 +;; 59 0.755 +;; 60 0.761 +;; 61 0.789 +;; 62 0.804 +;; 63 0.798 +;; 64 0.837 +;; 65 0.825 +;; 66 0.832 +;; 67 0.865 +;; 68 0.871 +;; 69 0.880 +;; 70 0.894 +;; 71 0.892 +;; 72 0.892 +;; 73 0.903 +;; 74 0.911 +;; 75 0.917 +;; 76 0.926 +;; 77 0.937 +;; 78 0.922 +;; 79 0.942 +;; 80 0.927 +;; 81 0.936 +;; 82 0.952 +;; 83 0.952 +;; 84 0.960 +;; 85 0.973 +;; 86 0.969 +;; 87 0.952 +;; 88 0.963 +;; 89 0.973 +;; 90 0.971 +;; 91 0.969 +;; 92 0.980 +;; 93 0.968 +;; 94 0.975 +;; 95 0.991 +;; 96 0.980 +;; 97 0.977 +;; 98 0.982 +;; 99 0.988 +;; nil + +