Model Simulasi: Random Number Genearator (RNG) Part. 2

LIZA EFRIYANTI
12 Mar 202105:49

Summary

TLDRIn this video, the process of generating random numbers using an additive RNG method is explained step by step. The presenter walks through the calculation of successive Z values (Z2 to Z5) using formulas involving multiplication and modulo operations. With each Z value, the process continues with calculations of R values. The video provides a clear example, showing how to calculate these random numbers while maintaining consistency with predefined constants and steps. The presenter concludes by hinting at the next video on using multiplicative RNG, keeping viewers engaged for upcoming content.

Takeaways

  • 😀 The video explains how to calculate random numbers using an additive random number generator (RNG).
  • 😀 The formula used in the RNG calculations is: Z(n+1) = (Zn * C + M) mod 128.
  • 😀 The speaker demonstrates step-by-step how to calculate values like Z2, Z3, and so on.
  • 😀 Each step involves multiplying Z values, adding constants, and performing modulo 128 operations to obtain new Z values.
  • 😀 After calculating each Z value, the speaker computes the corresponding R value by dividing the Z value by 128.
  • 😀 The final values of R2, R3, R4, and R5 are computed as 0.63, 0.875, 0.48, and 0.91, respectively.
  • 😀 The process involves taking the integer part of the division result before performing the next calculation.
  • 😀 The speaker uses specific constants: C = 19 and M = 237128, which remain consistent throughout the steps.
  • 😀 The calculations are rounded at each step to maintain consistency in the random number generation.
  • 😀 The video ends by previewing the next topic, which will cover the multiplicative RNG method for random number generation.

Q & A

  • What is the first random number generator method discussed in the video?

    -The first random number generator method discussed is the additive random number generator (additive RNG).

  • How is Z2 calculated in the additive random number generator method?

    -Z2 is calculated by taking Z1, multiplying it by a constant (in this case, 19), and then adding another constant (237), and the result is then divided by 128 to obtain the remainder.

  • Why is the result of the division rounded down when calculating Z2?

    -The result of the division is rounded down to the nearest whole number because the remainder after division is used to determine the next value in the series.

  • What is the importance of the constant 128 in this process?

    -The constant 128 is used as the modulus value, meaning that after multiplying the previous Z value by a constant and adding another constant, the result is divided by 128 to find the remainder, which determines the next Z value.

  • What does the 'R' value represent in the additive random number generator method?

    -The 'R' value represents the ratio of Z (the random number) to the modulus (128). It is calculated by dividing Z by 128 to obtain a fractional value.

  • How is Z3 calculated in the process?

    -Z3 is calculated similarly to Z2. The value of Z2 is multiplied by 19, then 237 is added to the result. This sum is then divided by 128, and the remainder is found to get Z3.

  • Why is only the whole number part of the division result used to calculate the next Z value?

    -Only the whole number part is used because the purpose is to find the remainder when dividing by 128, which is the key factor in determining the next random number in the sequence.

  • What steps are involved in calculating Z4 after Z3?

    -After calculating Z3, Z4 is determined by multiplying Z3 by 19, adding 237, dividing by 128, and then finding the remainder after division to get the next Z value.

  • How is the value of R4 calculated?

    -R4 is calculated by dividing Z4 by 128. The result is the ratio between the generated number and the modulus, yielding a fractional value.

  • What is the final step in the additive random number generation process as shown in the video?

    -The final step is calculating Z5, where Z4 is multiplied by 19, then 237 is added. The result is divided by 128, and the remainder is taken to get Z5. After that, R5 is calculated by dividing Z5 by 128.

Outlines

plate

This section is available to paid users only. Please upgrade to access this part.

Upgrade Now

Mindmap

plate

This section is available to paid users only. Please upgrade to access this part.

Upgrade Now

Keywords

plate

This section is available to paid users only. Please upgrade to access this part.

Upgrade Now

Highlights

plate

This section is available to paid users only. Please upgrade to access this part.

Upgrade Now

Transcripts

plate

This section is available to paid users only. Please upgrade to access this part.

Upgrade Now
Rate This

5.0 / 5 (0 votes)

Related Tags
Random NumbersRNG TutorialMathematicsModular ArithmeticAdditive RNGNumber GenerationProgrammingStatistical MethodsLearningEducational Video