Triumph RNG
Estimated Time: 15 minutes.

Last updated
Estimated Time: 15 minutes.

Last updated
using TriumphSDK;
public class GameController : MonoBehaviour {
public void generateBlocks()
{
// There are 8 columns to generate blocks in
for col in 1..<8 {
// Triumph.getNextRandom() will give a seeded uniform
// random variable in (0,1). Since we want a random bool, we just
// check if this random is >= 0.5, which will happen 50 percent
// of the time in expectation.
let triumphRandomSyncBool = Triumph.GetRandom() >= 0.5
// Old implementation
// if Bool.random() {
// New implementation
if triumphRandomSyncBool {
addBlock(inColumn: col)
}
}
}
}import TriumphSDK
class YourGameViewController {
// There are 8 columns to generate blocks in
func generateBlocks() {
for col in 1..<8 {
// Triumph.getNextRandom() will give a seeded uniform
// random variable in (0,1). Since we want a random bool, we just
// check if this random is >= 0.5, which will happen 50 percent
// of the time in expectation.
let triumphRandomSyncBool = Triumph.nextRandom() >= 0.5
// Old implementation
// if Bool.random() {
// New implementation
if triumphRandomSyncBool {
addBlock(inColumn: col)
}
}
}
}