RandomService
RandomService is an Angular Factory in the Util module with the name random.js
. It provides useful functions that use random numbers. To use these functions, see the documentation on injecting Angular services.
Name | Summary |
---|---|
spread | Given a value, will return a random integer between -value / 2 and value / 2. |
randomDim | For a given dimension, return a number from 0 to the dimension, within constraints. |
Function Descriptions
spread
Given a value, will return a random integer between -value / 2 and value / 2.
Example Usage | Arguments | Return Value |
---|---|---|
rs.spread(s ); | s - any number | given some value, Example: |
randomDim
For a given dimension, return a number from 0 to the dimension, within constraints.
Example Usage | Arguments | Return Value |
---|---|---|
rs.randomDim(d ); | d - any number | for a given dimension, |