package com.zhuguohui.app.lib.tools;
/**
* Created by zhuguohui
* Date: 2024/6/1
* Time: 13:39
* Desc:获取随机图片
*/
public class RandomImage {
// static final String url= "https://picsum.photos/%d/%d?random=%d";
static final String url= "https://source.unsplash.com/%dx%d/?beauty&random=%d";
public static String get(int width,int height){
return String.format(url,width,height,(int)(Math.random()*100));
}
}
上面的代码可以生成随机图片。而且内容可以指定 **“https://source.unsplash.com/%dx%d/?beauty&random=%d”**比如?后面的beauty返回的就是美女图片