Java Random Double randomFlip(double probTrue)

Here you can find the source of randomFlip(double probTrue)

Description

random Flip

License

Apache License

Declaration

public static boolean randomFlip(double probTrue) 

Method Source Code

//package com.java2s;
/*/*from   w  w  w .  j a va2 s .co  m*/
Copyright (c) 2012 IBM Corp.
    
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
    
http://www.apache.org/licenses/LICENSE-2.0
    
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
*/

public class Main {
    public static boolean randomFlip(double probTrue) {
        return Math.random() <= probTrue;
    }
}

Related

  1. randomDouble(int start, int end)
  2. randomDoubleArray(final int mDimensionality)
  3. randomDoubleArray(int len)
  4. randomDoubleBetween(double a, double b)
  5. randomDoubleOperand(Random rnd)
  6. randomIn(double in)
  7. randomInitialize(double[] base)
  8. randomInRange(double min, double max)
  9. randomPercent(double percent)