Here you can find the source of getId(BigDecimal total, BigDecimal step)
public static BigDecimal getId(BigDecimal total, BigDecimal step)
//package com.java2s; /*//from ww w. jav a 2s .c o m * Copyright(C) 2011-2012 Alibaba Group Holding Limited * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License version 2 as * published by the Free Software Foundation. * * Authors: * wentong <wentong@taobao.com> */ import java.math.BigDecimal; import java.util.Random; public class Main { private static final Random RANDOM = new Random(); public static BigDecimal getId(BigDecimal total, BigDecimal step) { return step.multiply(new BigDecimal(RANDOM.nextInt(total.intValue()))); } public static int nextInt(int i) { return RANDOM.nextInt(i); } }