⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 randoms.java

📁 使用java编写的关于通讯及串口编程所必需的类库
💻 JAVA
字号:
/* * Randoms.java * * This is a required part of the com.adaptiveview.ospso package. * * Copyright (C) 2003 AdaptiveView.com *  * This library is free software; you can redistribute it and/or * modify it under the terms of the GNU General Public * License as published by the Free Software Foundation; either * version 2 of the License, or (at your option) any later version. *  * This library 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 * General Public License for more details. *  * You should have received a copy of the GNU General Public * License along with this library; if not, write to the Free Software * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA *  * You may contact AdaptiveView.com via email at: comments.pso@adaptiveview.com  * */package com.adaptiveview.toolkits.numbers;/** * * @author  unknown */import java.util.Random;public final class Randoms implements com.adaptiveview.ospso.dmi.DMI_GPL_License {        public static final Random random = new Random();        /** Cannot create a new instance of Randoms */    private Randoms() {}        public static final double doubleInRange(double n1, double n2) {        if (n1 == n2) return n1;        double temp;        if (n1 < n2) {          temp = (n2 - n1);          return n1 + (random.nextDouble() * temp);        }        else {          temp = (n1 - n2);          return n2 + (random.nextDouble() * temp);        }    }   }

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -