Skip to content
On this page

randomNum

Definition:

js
/**
 * Generate a random number within a specified range.
 * @param min - The minimum value of the range.
 * @param max - The maximum value of the range.
 * @returns The generated random number within the specified range.
 * @description Generate a random number within the specified range [min, max].
*/

Demo

Min:
Max:
generated random number -> 65

Usage Example

ts
import { computed, ref } from 'vue'
import { randomNum } from 'utils-snap-fn'

const min = ref(0)
const max = ref(100)
const num = computed(() => {
  return randomNum(min.value, max.value)
})

Source Code

utils-snap-fn-docs