|
@@ -632,13 +632,14 @@
|
|
return geometry.copy(id);
|
|
return geometry.copy(id);
|
|
}
|
|
}
|
|
|
|
|
|
- // from http://stackoverflow.com/questions/105034/how-to-create-a-guid-uuid-in-javascript/2117523#answer-2117523
|
|
|
|
- // be aware Math.random() could cause collisions
|
|
|
|
|
|
+ /**
|
|
|
|
+ * You should now use Tools.RandomId(), this method is still here for legacy reasons.
|
|
|
|
+ * Implementation from http://stackoverflow.com/questions/105034/how-to-create-a-guid-uuid-in-javascript/2117523#answer-2117523
|
|
|
|
+ * Be aware Math.random() could cause collisions, but:
|
|
|
|
+ * "All but 6 of the 128 bits of the ID are randomly generated, which means that for any two ids, there's a 1 in 2^^122 (or 5.3x10^^36) chance they'll collide"
|
|
|
|
+ */
|
|
public static RandomId(): string {
|
|
public static RandomId(): string {
|
|
- return 'xxxxxxxx-xxxx-4xxx-yxxx-xxxxxxxxxxxx'.replace(/[xy]/g, c => {
|
|
|
|
- var r = Math.random() * 16 | 0, v = c === 'x' ? r : (r & 0x3 | 0x8);
|
|
|
|
- return v.toString(16);
|
|
|
|
- });
|
|
|
|
|
|
+ return Tools.RandomId();
|
|
}
|
|
}
|
|
|
|
|
|
public static ImportGeometry(parsedGeometry: any, mesh: Mesh): void {
|
|
public static ImportGeometry(parsedGeometry: any, mesh: Mesh): void {
|