Here you can find the source of shuffle(String str, Random randObj)
Parameter | Description |
---|---|
str | a parameter |
randObj | a parameter |
public static String shuffle(String str, Random randObj)
//package com.java2s; //License from project: Open Source License import java.util.Random; public class Main { /**/*w w w.ja v a2 s . c o m*/ * Single nucleotide shuffle * @param str * @param randObj * @return */ public static String shuffle(String str, Random randObj) { if (str.length() <= 1) return str; int split = str.length() / 2; String temp1 = shuffle(str.substring(0, split), randObj); String temp2 = shuffle(str.substring(split), randObj); if (randObj.nextDouble() > 0.5) return temp1 + temp2; else return temp2 + temp1; } }