Here you can find the source of generateRandomTargetId(final String uniqueId, final int count)
Parameter | Description |
---|---|
uniqueId | The unique id for a topic. |
count | The count of topics in the process. |
public static String generateRandomTargetId(final String uniqueId, final int count)
//package com.java2s; /*/*from w w w . j av a 2 s .com*/ Copyright 2011-2014 Red Hat, Inc This file is part of PressGang CCMS. PressGang CCMS is free software: you can redistribute it and/or modify it under the terms of the GNU Lesser General Public License as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version. PressGang CCMS is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more details. You should have received a copy of the GNU Lesser General Public License along with PressGang CCMS. If not, see <http://www.gnu.org/licenses/>. */ public class Main { /** * Generates a random target it in the form of T<Line Number>0<Random Number><count>. * I.e. The topic is on line 50 and the target to be created for is topic 4 in a process, the * output would be T500494 * * @param uniqueId The unique id for a topic. * @param count The count of topics in the process. * @return The partially random target id. */ public static String generateRandomTargetId(final String uniqueId, final int count) { return generateRandomTargetId(uniqueId) + count; } /** * Generates a random target it in the form of T-<UniqueId>0<Random Number>. * The random number is between 0-49. * * @param uniqueId The unique id for a topic. * @return The partially random target id. */ public static String generateRandomTargetId(final String uniqueId) { int randomNum = (int) (Math.random() * 50); return "T-" + uniqueId + "0" + randomNum; } }