* @zh 生成随机方向向量 * @en Generate random direction vector
()
| 175 | * @en Generate random direction vector |
| 176 | */ |
| 177 | nextDirection2D(): { x: number; y: number } { |
| 178 | const theta = this.next() * 2 * Math.PI; |
| 179 | return { |
| 180 | x: Math.cos(theta), |
| 181 | y: Math.sin(theta) |
| 182 | }; |
| 183 | } |
| 184 | } |
| 185 | |
| 186 | /** |