22 lines
475 B
TypeScript
22 lines
475 B
TypeScript
const generatePhotos = (number: number, startId: number) => {
|
|
const photos = [];
|
|
|
|
for (let i = 0; i < number; i++) {
|
|
const id = startId + i;
|
|
const width = 200 + Math.floor(Math.random() * 200);
|
|
const height = 200 + Math.floor(Math.random() * 200);
|
|
|
|
photos.push({
|
|
id,
|
|
src: `https://picsum.photos/id/${id}/${width}/${height}`,
|
|
alt: `Photo ${id}`,
|
|
width,
|
|
height,
|
|
});
|
|
}
|
|
|
|
return photos;
|
|
};
|
|
|
|
export default generatePhotos;
|