Tools2Boost

Porogaramu yingirakamaro kumurongo

Gukora integer zidasanzwe

Koresha iyi page kugirango ubyare imibare idahwitse ya porogaramu muri coding, kugerageza & byinshi.

Umubare ntarengwa (integer)
Umubare ntarengwa (integer)

Gukora pseudorandom integer

Gufungura Amayobera ya Pseudorandom Yuzuye: Porogaramu, Algorithms, na Imipaka

Igisekuru cya pseudorandom integer nigice cyingenzi cyibikorwa byinshi byo kubara, harimo kwigana, sisitemu yo gushushanya, imikino, no kugerageza algorithms. Ijambo "pseudorandom" rikoreshwa kuko mugihe iyo mibare igaragara nkimpanuka, itangwa nuburyo bwo kumenya ibintu. Urebye imiterere yambere cyangwa "imbuto", generator yumubare uteganijwe (PRNG) izatanga urutonde rumwe rwimibare buri gihe. Uyu mutungo ni ingirakamaro mubice byinshi, nko gukemura cyangwa gukoresha ibigereranyo bigenzurwa, aho bikenewe gusubiramo.

PRNGs ikora mukoresha algorithm itanga urukurikirane rwimibare hagati yurwego rwihariye rugereranya imiterere yimibare idasanzwe. Kuri integer, uru rutonde rwaba ruri hagati yumubare ntarengwa nagaciro ntarengwa integer ishobora gufata. Hano haribintu byinshi byitwa pseudorandom generation generation algorithms irahari, uhereye kubintu byoroshye nka Linear Congruential Generator (LCG) kugeza kuri byinshi bigoye nka Mersenne Twister. Guhitamo algorithm mubisanzwe biterwa nibikenewe byihariye bya porogaramu, harimo urwego rwo guhitamo, imikorere, hamwe no gukoresha imikoreshereze.

Mugihe cyo kubyara pseudorandom integer, algorithm ifata imbuto yambere, hanyuma ikora urukurikirane rwibikorwa byimibare kuri yo kugirango itange agaciro gashya. Agaciro gashya noneho kaba imbuto yo gukurikira gutaha, kurema urukurikirane rwimibare ya pseudorandom. Imbuto isanzwe ikomoka kubintu bimwe na bimwe bitateganijwe, nkigihe cyubu, kugirango tumenye neza ko urutonde rwimibare itandukanye buri gihe gahunda ikora.

Ariko, ni ngombwa kumenya ko generator ya pseudorandom idakwiye kubisabwa byose. Nubwo zishobora kugaragara nkimpamvu nyinshi, ziracyafite ibyemezo kandi imiterere yabyo irashobora guhanurwa hatanzwe amakuru ahagije kuri algorithm nimbuto. Kubwimpamvu zifatika, aho umutekano uhangayikishijwe, hashyizweho uburyo bwizewe bwerekana imibare itanga amashanyarazi (CSPRNGs). Ibi byarakozwe kuburyo nubwo uwagabye igitero azi algorithm nibindi byose ariko uduce duto twa nyuma twimbuto, ntibashobora guhanura umubare ukurikira mukurikirana.

Mu gusoza, igisekuru cyibintu byitwa pseudorandom ni ingingo ishimishije ihuza imibare, siyanse ya mudasobwa, hamwe nibikorwa bifatika. Nubwo imiterere yabyo, imibare yibinyoma nibikoresho byingirakamaro muri domaine zitandukanye. Mugusobanukirwa uburyo byakozwe hamwe nibintu bagaragaza, turashobora guhitamo no gushyira mubikorwa PRNGs kugirango duhuze ibyifuzo byihariye bya porogaramu zacu, mugihe tuzirikana aho ubushobozi bwabo bugarukira hamwe nibishobora gukenerwa muburyo bukomeye mubihe byinshi byugarije umutekano.