You are here

function realistic_dummy_content_api_rand in Realistic Dummy Content 8

Same name and namespace in other branches
  1. 8.2 api/realistic_dummy_content_api.module \realistic_dummy_content_api_rand()
  2. 7.2 api/realistic_dummy_content_api.module \realistic_dummy_content_api_rand()
  3. 7 api/realistic_dummy_content_api.module \realistic_dummy_content_api_rand()
  4. 3.x api/realistic_dummy_content_api.module \realistic_dummy_content_api_rand()

Generate a random, or sequential, number

By default, this function will return a random number between $start and $end inclusively. If you set the realistic_dummy_content_api_rand variable to REALISTIC_DUMMY_CONTENT_SEQUENTIAL, for example for automated tested or in a recipe (an example can be found at realistic_dummy_content/recipe/realistic_dummy_content.recipe.inc), then this will call realistic_dummy_content_api_sequential().

See the documentation for realistic_dummy_content_api_sequential() for details.

Parameters

$start: The first possible number in the range.

$end: The last possible number in the range.

$hash = NULL: Ignored for random numbers; for sequential numbers, please se the documentation for realistic_dummy_content_api_sequential() for details.

Return value

A random number by default, or a sequential number if you set the realistic_dummy_content_api_rand variable to REALISTIC_DUMMY_CONTENT_SEQUENTIAL. Please see the description of realistic_dummy_content_api_sequential() for details.

1 call to realistic_dummy_content_api_rand()
FieldModifier::rand in api/src/manipulators/FieldModifier.php
Generate a random number, or during tests, give the first available number.
3 string references to 'realistic_dummy_content_api_rand'
RealisticDummyContent::rand in api/src/facade/RealisticDummyContent.php
Generate a random, or sequential, number
RealisticDummyContentDbTestCase::setUp in api/src/Tests/RealisticDummyContentDbTestCase.php
Enable the module
realistic_dummy_content_api_uninstall in api/realistic_dummy_content_api.install
Implements hook_uninstall().

File

api/realistic_dummy_content_api.module, line 118
API code allowing other modules to generate realistic dummy content. See the Realistic Dummy Content module for an example of how to use.

Code

function realistic_dummy_content_api_rand($start, $end, $hash = NULL) {
  return RealisticDummyContent::rand($start, $end, $hash);
}