当前位置 : 主页 > 编程语言 > java >

取范围内的值

来源:互联网 收集:自由互联 发布时间:2021-06-28
取得数据在一个范围内,不超过最大小值,不小于最小值。 public static float clamp(float number, float min, float max) { return Math.max(min, Math.min(max, number)); }
取得数据在一个范围内,不超过最大小值,不小于最小值。
public static float clamp(float number, float min, float max) {
    return Math.max(min, Math.min(max, number));
  }
网友评论