This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
describe('newPRNG', () => { | |
test('should generate seeded random values', () => { | |
expect(newPRNG(123)(new Array(5))).toEqual([-220828386, -1556571610, 1450074142, -2011800852, 1359997245]); | |
expect(Buffer.from(newPRNG(123)(new Int8Array(20))).toString('hex')).toBe( | |
'1ef2d66d26a3389a1e566e60ec88165a3d510fe9', | |
); | |
expect(Buffer.from(newPRNG(123)(new Int8Array(20))).toString('hex')).toBe( | |
'1ef2d66d26a3389a1e566e60ec88165a3d510fe9', | |
); | |
expect(Buffer.from(newPRNG(123)(new Uint8ClampedArray(10))).toString('hex')).toBe('1ef2d66d26a3389a1e56'); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import { useSyncExternalStore } from "react"; | |
import type { ConsumerProps, FC, ReactNode } from "react"; | |
export interface ReactAtom<T> { | |
readonly get: () => T; | |
readonly sub: (listener: () => void) => () => void; | |
} | |
/** | |
* Hook: Use an atom value in a react component. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/// <summary> | |
/// Computes the intersection points between a frustum and an infinite line. | |
/// Finds the visible part of a segment in respect of a camera frustum. | |
/// Returns false if the line is not visible at all. | |
/// </summary> | |
/// <example> | |
/// var planes = GeometryUtility.CalculateFrustumPlanes(camera); | |
/// if (GetFrustumLineIntersection(camera, planes, ray, out d1, out d2)) { | |
/// Gizmos.DrawLine(ray.GetPoint(d1), ray.GetPoint(d2)); | |
/// } |