跳到内容

A Random Number

v1.3.0

Mortgage Calculator · 2016年1月12日 上架

Display a random number anywhere with a shortcode. Set a min/max range, choose number formatting and get a fresh value on every page load.

正在使用
700+
评分
3.7 / 5
累计下载
1.6 万
最近更新
2026年10月28日
6 条评价需要 WordPress 5.8+已测试到 7.1.5PHP 7.4+

截图

Random numbers on a page, each shortcode with its own minimum and maximum.
Random numbers on a page, each shortcode with its own minimum and maximum.
The Random Number block in the block editor, with minimum and maximum in the sidebar (the [arandomnumber] shortcode works too).
The Random Number block in the block editor, with minimum and maximum in the sidebar (the [arandomnumber] shortcode works too).

A Random Number adds a simple random number generator to WordPress. Add the “A Random Number” block in the block editor, or put the [arandomnumber] shortcode in any post, page or widget, and it prints a new random number every time the page loads. Use it as many times as you like on the same page.

Features

  • Gutenberg block with minimum, maximum and thousands-separator settings and a live preview
  • Random number generator shortcode for posts, pages and text widgets
  • Custom range with the min and max attributes (default 1 to 100)
  • Negative numbers and large ranges are supported
  • Thousands separators on by default, switch them off with comma=no
  • Insert button in the classic editor (visual and text mode)
  • No settings page and no database tables to manage

How to use

In the block editor click the add-block button, search for “A Random Number” and set the range in the block sidebar.

Or add the shortcode wherever you want the number to appear. The default range is 1 to 100.

[arandomnumber]

Pick your own range with min and max:

[arandomnumber min=1 max=10000]

This prints a number between 1 and 10,000, for example 8,014.

[arandomnumber min=-500 max=-1]

This prints a number between -500 and -1, for example -232.

[arandomnumber min=50000000 max=60000000]

This prints a number between 50,000,000 and 60,000,000, for example 56,449,060.

To print the number without thousands separators use comma=no:

[arandomnumber min=100000 max=999999 comma=no]

This prints something like 456245.

Use cases

  • Giveaway or contest placeholder numbers
  • Lucky numbers, dice-style demos and games
  • Test data and sample figures while you build a page
  • Random values for form fields or URLs
  • Checking whether a page is cached: the number changes on every uncached page load

Plums

按场景查找 WordPress 插件。安装量、评分和兼容版本来自官方目录。

导航

说明

WordPress 是 WordPress Foundation 的商标。本站与 WordPress Foundation、Automattic 没有隶属关系。这里不托管插件文件,下载和安装以 WordPress.org 上的页面为准。

© 2026 Plums