• java代码---------比较随机数的大小---我搞不懂啊


    总结:不习惯你在或不在的时候,赶紧走吧

    package com.mmm;
    
    import java.util.Random;
    
    public class wW {
    	public static double aaa() {
    		double s = 0.0;
    
    		while (true) {
    			if ((s = Math.random() * 10) < Math.PI) {
    				break;
    			}
    			// 刚定义double型时在外部报错,以为不在方法里面了
    
    		}
    
    		return 0;
    
    	}
    
    	public static void main(String[] args) {
    		Random r = new Random();
    		int s = 0, s2 = 0;
    		s = (int) (Math.random() * 10);
    		s2 = (int) (Math.random() * 10);
    		// s=(int)(Math.random()*10);
    		// double a=aaa();
    		// double b=aaa();
    		double max = Math.max(s, s2);
    		System.out.println(max);
    		System.out.println(Math.sin(max));
    		System.out.println(Math.cos(max));
    
    	}
    
    }
    

      

  • 相关阅读:
    mplayer命令行模式下的使用方法
    CentOS安装wireshark
    CentOS查看系统信息
    测试理论1
    单例模式
    接口测试
    rabbitmq
    redis数据库
    时间模块
    charles抓取数据
  • 原文地址:https://www.cnblogs.com/langlove/p/3497069.html
Copyright © 2020-2023  润新知