예제 #1
0
        @Override
        public void run() {
          final int N = getChildCount();

          final int K = 1; // irand(1,3);
          for (int i = 0; i < K; i++) {
            final View child = getChildAt((int) (Math.random() * N));
            place(child, true);
          }

          fillFreeList();

          if (mStarted) {
            mHandler.postDelayed(mJuggle, DELAY);
          }
        }
예제 #2
0
 static float frand() {
   return (float) (Math.random());
 }
예제 #3
0
 <T> T pick(SparseArray<T> sa) {
   return sa.valueAt((int) (Math.random() * sa.size()));
 }
예제 #4
0
 <T> T pick(T[] a) {
   return a[(int) (Math.random() * a.length)];
 }
예제 #5
0
 int pick(int[] a) {
   return a[(int) (Math.random() * a.length)];
 }