Computer Science - 9210 OxfordAQA

Random Number Generation In A Programming

Gbogbo ọrọ náà

A computer is the most predictable machine ever built. Give it the same input twice and it gives you the same answer twice, which is exactly what you want from a payroll system and exactly what you do not want from a game of snakes and ladders. Somewhere in that game a die has to be thrown, and the machine has to produce a number it did not know it was going to produce.

This lesson covers the one objective the specification sets here: be able to use random number generation. It also covers the boundary the specification draws, because knowing what is not asked for saves revision time. You will learn how to generate a number in a given range and count how many values that range holds, how to make a choice with equal chance, how to keep generating until you get a value you can use, and why a program that behaves differently every time is harder to test than one that does not.

Ebumnobi

  1. Be able to use random number generation.

Maapụ uche

E seela isiokwu a ka ị hụ otu echiche si ejikọta.

Mepee maapụ uche na ngwa

Akwụkwọ Ọmụmụ

Random number generation gives a program a value it could not have worked out in advance. Without it a great deal of software would be impossible, and the examples are not all games.

Ndetu Nkuzi Zuru Ezu di na Ngwa Green Bridge

Nweta ngwa Green Bridge CBT na ekwenti gi ma o bu kompiuta maka ulo akwukwo IGCSE zuru oke: akwukwo ule ndi gara aga, usoro nyocha, eserese uche, kaadi omumu na nkuzi olu.

Akwụkwọ ndụmọdụ zuru oke nwere eserese
Onye inyeaka mmụta AI
Ule nnwale nwere oge a na-ahazi ozugbo i mechara
Ọ dị na Android, Windows, macOS, na Linux Ngwa iOS na-abia n'oge na-adighi anya

Nnyocha Ọmụmụ

Ekele diri gi maka imecha ihe karịrị na Random Number Generation In A Programming. Ugbu a na ị na-enyochakwa isi echiche na echiche ndị dị mkpa, ọ bụ oge iji nwalee ihe ị ma. Ngwa a na-enye ụdị ajụjụ ọmụmụ dị iche iche emebere iji kwado nghọta gị wee nyere gị aka ịmata otú ị ghọtara ihe ndị a kụziri.

Ị ga-ahụ ngwakọta nke ụdị ajụjụ dị iche iche, gụnyere ajụjụ chọrọ ịhọrọ otu n’ime ọtụtụ azịza, ajụjụ chọrọ mkpirisi azịza, na ajụjụ ede ede. A na-arụpụta ajụjụ ọ bụla nke ọma iji nwalee akụkụ dị iche iche nke ihe ọmụma gị na nkà nke ịtụgharị uche.

Jiri akụkụ a nke nyocha ka ohere iji kụziere ihe ị matara banyere isiokwu ahụ ma chọpụta ebe ọ bụla ị nwere ike ịchọ ọmụmụ ihe ọzọ. Ekwela ka nsogbu ọ bụla ị na-eche ihu mee ka ị daa mba; kama, lee ha anya dị ka ohere maka ịzụlite onwe gị na imeziwanye.

  1. How many different values can RANDOM(3, 9) produce, if both bounds are included? A. 6 B. 7 C. 9 D. 12 Answer: B
  2. An array holds 20 elements. Which call generates a valid index? A. RANDOM(0, 19) B. RANDOM(0, 20) C. RANDOM(1, 20) D. RANDOM(1, 21) Answer: A
  3. Which structure is used to keep generating a random number until an acceptable value appears? A. A definite loop B. A nested selection C. An indefinite loop D. A subroutine call Answer: C
  4. A program chooses one of two players at random and must give each an equal chance. Which call is correct? A. RANDOM(0, 1) B. RANDOM(0, 2) C. RANDOM(1, 10) D. RANDOM(2, 2) Answer: A
  5. According to the specification, which of these is NOT required? A. Using random number generation within a program B. Choosing an appropriate range for a task C. Understanding how pseudo-random numbers are generated D. Storing a randomly generated value in a variable Answer: C

Rue ajuju ndi a n'ime ngwa ahu

Rue ajuju ndi a n'ime ngwa ahu

Meecha Ajụjụ Ule Ọmarịcha

Ị chọrọ ime ajụjụ ule ọmarịcha gbasara Random Number Generation In A Programming? Budata ngwa Green Bridge CBT iji nweta ajụjụ ule ọmarịcha na nyocha zuru ezu gbasara isiokwu a.

Budata Ngwa Ahụ Na Google Playstore

Ihe nile ichoro iji nwee ihe ịga nke ọma na JAMB, WAEC & NECO.

Green Bridge CBT Mobile App
Onye Enyemaka Nkata AI Nke Ọmụmụ Ihe Ahaziri Maka Gị
Ajụjụ ule IGCSE, JAMB, WAEC na NECO karịrị 200,000
Ihe karịrị 1200 Nkọwa Nkuzi
Nkwado Na-enweghị Ịntanetị - Mụọ Ihe Mgbe Ọ Bụla, Ebe Ọ Bụla
Jadawalin Gada Kore
Akọkọ akọle iwe & Ibeere agbara
Sọfụma Ọrụ Gi & Ọganihu Gi
Nkọwa Miri Emi Maka Ọmụmụ Ihe Zuru Ezu