Various utilities. Some of them are used by ceramic itself or its backends.
Static methods
staticuniqueId():String
Provides an identifier which is garanteed to be unique on this local device. It however doesn't garantee that this identifier is not predictable.
staticrandomId(size:Int = 32):String
Provides a random identifier which should be fairly unpredictable and should have an extremely low chance to provide the same identifier twice.
staticpersistentId(slot:Int = 0, size:Int = 32):String
Return a persistent identifier for this device. The identifier is expected to stay the same as long as the user keeps the app installed. Multiple identifiers can be generated/retrieved by using different slots (default 0). Size of the persistent identifier can be provided, but will only have effect when generating a new identifier.
staticinlinehashCode(s:String):Int
Java's String.hashCode() method implemented in Haxe. source: https://github.com/rjanicek/janicek-core-haxe/blob/master/src/co/janicek/core/math/HashCore.hx
staticuniformFrequencyList(values:Array<Int>, frequencies:Array<Float>, size:Int):Array<Int>
Generate an uniform list of the requested size, containing values uniformly repartited from frequencies.
Parameters:
values | the values to put in list |
---|---|
probabilities | the corresponding probability for each value |
size | the size of the final list |
staticupperCaseToCamelCase(input:String, firstLetterUppercase:Bool = true):String
Transforms SOME_IDENTIFIER
to SomeIdentifier
staticcamelCaseToUpperCase(input:String, firstLetterUppercase:Bool = true):String
Transforms SomeIdentifier
/someIdentifier
/some identifier
to SOME_IDENTIFIER
staticsinRatio(value:Float):Float
Transforms a value between 0 and 1 to another value between 0 and 1 following a sinusoidal curve
Parameters:
value | a value between 0 and 1. If giving a value > 1, its modulo 1 will be used. |
---|
Returns:
Float
staticcosRatio(value:Float):Float
Transforms a value between 0 and 1 to another value between 0 and 1 following a cosinusoidal curve
Parameters:
value | a value between 0 and 1. If giving a value > 1, its modulo 1 will be used. |
---|
Returns:
Float
staticvalueFromInterpolatedKey(keys:Array<Float>, values:Array<Float>, interpolatedKey:Float):Float
Given an array of keys and an array of matching values, interpolate a new value from interpolatedKey
Parameters:
keys | A list of keys |
---|---|
values | A list of values |
interpolatedKey | The interpolated key, used to find a matching interpolated value |
Returns:
Interpolated value
staticyFromInterpolatedX(points:Array<Float>, interpolatedX:Float):Float
Given an array of X and Y values, interpolate a new Y value from interpolated X
Parameters:
points | A list of X and Y values |
---|---|
interpolatedX | The interpolated X key, used to find a matching interpolated Y |
Returns:
Interpolated Y value