Minecraft Wiki

除另有声明,转载时均必须注明出处若簡繁轉換出錯,請以遊戲內為準请勇于扩充与修正内容有兴趣逛逛我们的微博沟通交流,欢迎到社区专页需要协助,请在告示板留言

了解更多

Minecraft Wiki
Advertisement

Template:Translation:未知參數。 隨機發生器是會產生隨機訊號的紅石電路。它們能被應用在很多地方,從操縱一場燈光表演,到建造一個賭場。特別指出,隨機發生器像大多數紅石電路一樣,只能在已載入出的區塊裡工作。如果是用於一個探險地圖或一些玩家會走得很遠的地圖,可以將隨機發生器建造在重生點區塊[僅Java版]常載入區域[僅基岩版]

實體隨機發生器

投擲器隨機發生器

一個投擲器隨機發生器

這個隨機發生器利用了這樣一個事實,投擲器以隨機順序發射物品。每當提供一個訊號時,它會輸出一個強度為1或3的訊號。 要建造它,按照圖中的方式放置一個投擲器,漏斗,和紅石比較器。 然後把有不同堆疊上限的物品放入投擲器中,如一把劍和一塊泥土。當你啟動投擲器,它會把一個物品放入漏斗,從而啟動比較器。 由於物品占用的空間不同,因此訊號強度也會有所不同。看起來好像將物品數堆疊至16時會輸出強度為2的訊號,但不幸的是除非漏斗事先裝了物品,否則將物品數堆疊至16隻能得到強度為1的訊號。

界伏盒隨機發生器

界伏盒能被發射器放置,被活塞破壞,並保留其中的物品。當一個界伏盒被發射器隨機放置時,比較器可以產生15種不同的紅石訊號。

生物隨機發生器

絆線鈎製作的豬隨機發生器
壓力板製作的生物隨機發生器(顯示出了紅石)

生物隨機發生器是利用生物隨機移動的特性觸發紅石的隨機發生器。當需要多個輸出時,這種隨機發生器是最好的。訊號何時發生或持續多久都無關緊要。 豬隨機發生器通常用壓力板絆線鈎製作。用絆線鈎是最簡單的方法,但是需要更多鐵。

隨機發生器中使用的生物類型可以創造出一些重要的變種。一些常見的選擇包括:

  • , 因為它們很小而且容易繁殖。
  • 雪人, 因為它們很安靜。
  • 和其他兩格寬的生物, 因為它們處於觸發機關狀態時的可能性更大。
  • 蝙蝠,因為它們會頻繁地開關機關。

唱片機隨機發生器

Information icon
此特性為基岩版獨有。
In
唱片機隨機發生器

這種隨機發生器使用唱片機漏斗產生強度為1-12的隨機紅石訊號。此機器的獨特之處在於大多數其他的隨機發生器不會產生具有如此多可能性的模擬訊號。這種隨機發生器的兩個缺點是,它只能在每個唱片播放完畢並取走後才會改變訊號,並且這可能造價高昂。

Randomizers with analog signal output

Analog 2-RNG

Analog 2-RNG

The dropper contains one stackable item and one non-stackable item.



1×3×2 (6 block volume), 1-wide, flat, silent
circuit delay: 3 ticks (rising) and 1 tick (falling)

Outputs either power level 1 or 3 while on, power level 0 while off.

When the input turns on, the dropper will randomly choose to push either the stackable item or the non-stackable item into the hopper, causing the comparator to output either power level 1 or 3. Because the powered dropper is a solid/opaque block, it will also deactivate the hopper, preventing it from pushing the item back to the dropper until the input turns off.

The output power level can be used as is (for example, to subtract 1 or 3 from a comparator in subtraction mode), but more often the output is connected to a line of two redstone dust so that the output is 0 or not 0 (to randomly power a repeater, activate a mechanism component, etc.).

Variations: If the dropper is powered indirectly (for example, by quasiconnecitvity or an adjacent powered block), the hopper won't be deactivated and will immediately push the item back into the dropper. This turns the circuit into a monostable rising edge detector with a 3.5-tick output pulse (still with a random power level of 1 or 3).

With only two items in the dropper, both output power levels will be chosen with equal probability. The probability of the output levels can be changed by adding additional stackable and non-stackable items to the dropper (which must all be different from each other so they won't stack). For example, with two different stackable items and three different non-stackable items, the RNG will output power level 1 40% of the time and power level 3 60% of the time.

Earliest Known Publication: March 14, 2013[1]

Analog 3-RNG

Analog 3-RNG

The dropper contains one 64-stackable item, one 16-stackable item, and one non-stackable item.



The hopper contains five 16-stackable items in the far right slot.

5
1×3×3 (9 block volume), 1-wide, silent
circuit delay: 3 ticks (rising) and 1 tick (falling)
Outputs power levels 1, 2, or 4 while on, power level 1 while off (but see variations below).
When building this circuit, wait until the hopper is deactivated by the powered dust before putting five 16-stackable items in its far right slot. Then put a 64-stackable item, a 16-stackable item, and a non-stackable item in the dropper.
Before the input turns on, the hopper's five 16-stackable items are enough to produce a power level 1 output from its comparator (even a single 64-stackable item would be enough for that). These five items should never be returned to the dropper, so the comparator's output will never drop below power level 1.
When the input turns on, the dropper will push an item into the hopper, which will be placed in the hopper's left slot. It takes 23 64-stackable items (or five 16-stackable items and three 64-stackable items, or six 16-stackable items) to produce power level 2, so if the 64-stackable item is pushed that won't be enough to increase the output power level, but if the 16-stackable item is pushed the output power level will increase to 2. And if the non-stackable item is pushed, the output power level will increase to 4.
The hopper is held deactivated by the powered dust when the circuit is off, and by the powered dropper when the circuit is on. But, when the input turns off, there is a brief 1-tick moment when the dropper has just turned off, but the torch attached to it hasn't turned on again. This allows the hopper to activate for 1 tick, pushing an item back into the dropper. A hopper always pushes items from its left slots first, so the hopper will push back the item the dropper pushed into it, rather than any of the 16-stackable items in its far right slot, allowing the circuit to reset itself.
Variations: The player can remove one of the items from the dropper to create a 2-RNG with different power level outputs than the regular 2-RNG: removing the 64-stackable item outputs power levels 2 or 4, removing the 16-stackable item outputs power levels 1 or 4, and removing the non-stackable item outputs power levels 1 or 2.
You can add additional redstone dust leading from the hopper to a block next to it, and then down to the side of the comparator. This 2-wide variation will keep the comparator's output off while the input is off.
With only three items in the dropper, all three output power levels will be chosen with equal probability. The probability of the output levels can be changed by adding additional 64-stackable, 16-stackable, and non-stackable items to the dropper (which must all be different from each other so they won't stack). For example, with one 64-stackable item, one 16-stackable item, and two different non-stackable items, the RNG will output power level 1 25% of the time, power level 2 25% of the time, and power level 4 50% of the time.
Additional items can be added to the hopper to increase all of the output power levels.
Earliest Known Publication: 16 April 2013[2]

Analog 16-RNG

5×8×4 (160 block volume)
circuit delay: 8.5 ticks
Outputs power levels 0 to 15 while on, power level 0 while off.
Uses four 2-RNGs to subtract 1, 2, 4, and/or 8 from 15.
Reducing the number of 2-RNGs reduces the possible outputs: three 2-RNGs produces an 8-RNG, and two 2-RNGs produces a 4-RNG (the exact power levels depend on the power level provided to the subtraction comparators).
Earliest Known Publication: June 10, 2013[3]

Schematic: Analog 16-RNG

參見:Mechanics/Redstone/Miscellaneous circuits/analog 16-rng [編輯]

Command randomizers

Tick-based

Information icon
此特性為Java版獨有。

This randomizer uses a repeating command block adding 1 point to a score per tick, then another repeating command block truncating the value to its maximum. When a random value is needed, repeating command blocks testing for certain values are used. This setup is not completely random as it is based on the time is is activated, but is random enough for most purposes.

In this example, the minimum value is 10 and the maximum is 20. To start, a dummy scoreboard objective must be created to store the values: /scoreboard objectives add randomizer dummy. Next, two repeating command blocks are needed, both set to "always active". The first one adds 1 point to the score every tick: /scoreboard players add ticks randomizer 1. The second one truncates the value to the aforementioned minimum and maximum: /execute if score ticks randomizer matches 21.. run scoreboard players set ticks randomizer 10 (where "21" is the maximum exclusive value and "10" is the minumum value). Finally, a set of command blocks testing each value are needed, all attached to the single input; for example, /execute if score ticks randomizer matches 2 run say hi will run /say hi (placing [@] hi in chat) if the random value between 10 and 20 is 2. The following schematic shows an example setup where the command blocks testing each value are attached to an input:

Tick-based randomizer
  1. "HiFolksImAdam" (14 March 2013). "Minecraft 1.5 Tutorial: Simple Random Number Generator!" (Video) – YouTube.
  2. "Kwin van der Veen" (April 16, 2013). "Video response: Sharing is Caring #010: 1 Bit Randomizer & Silent BUD " (Video). YouTube.
  3. "Entity" (June 10, 2013). "Calling All Redstone Geniuses, I need Help. - advanced randomizer."Minecraft Forum
Advertisement