MCPcopy Create free account
hub / github.com/Xu22Web/tech-study-js / createRandomPoint

Function createRandomPoint

tech-study.js:2266–2277  ·  view source on GitHub ↗

* @description 创建随机点 * @param bounds 范围 * @returns

(bounds)

Source from the content-addressed store, hash-verified

2264 * @returns
2265 */
2266function createRandomPoint(bounds) {
2267 // 范围
2268 const { x, y, width, height } = bounds;
2269 // 横坐标
2270 const randX = x + Math.random() * width * 0.5 + width * 0.25;
2271 // 纵坐标
2272 const randY = y + Math.random() * height * 0.5 + height * 0.25;
2273 return {
2274 x: randX,
2275 y: randY,
2276 };
2277}
2278/**
2279 * @description 生成随机路径
2280 * @param start

Callers 1

handleSlideVerifyFunction · 0.70

Calls

no outgoing calls

Tested by

no test coverage detected