Faker - generátor pseudonáhodného obsahu objektů v C#
Faker - pseudorandom object content C# generator
bachelor thesis (DEFENDED)
View/ Open
Permanent link
http://hdl.handle.net/20.500.11956/152537Identifiers
Study Information System: 234132
Collections
- Kvalifikační práce [11196]
Author
Advisor
Referee
Dingle, Adam
Faculty / Institute
Faculty of Mathematics and Physics
Discipline
Programming and Software Systems
Department
Department of Distributed and Dependable Systems
Date of defense
10. 9. 2021
Publisher
Univerzita Karlova, Matematicko-fyzikální fakultaLanguage
Czech
Grade
Excellent
Keywords (Czech)
Faker|pseudonáhodný|PRNG|xoshiro256**|.NET knihovnaKeywords (English)
Faker|pseudorandom|PRNG|xoshiro256**|.NET libraryCílem této práce bylo vytvořit softwarovou knihovnu Faker schopnou vyplňovat in- stance uživatelem definovaných tříd pseudonáhodným obsahem. Tato knihovna by měla cílit na platformu .NET. Požadavky, které by měla knihovna Faker splňovat, byly odvo- zeny na základě rozboru existujících implementací podobných knihoven pro různé pro- gramovací jazyky. Jako zdroj pseudonáhodných čísel byl zvolen PRNG algoritmus xoshiro256**. Fa- ker dokáže na základě pseudonáhodných 64-bitových slov, produkovaných algoritmem xoshiro256**, generovat pseudonáhodné hodnoty všech základních datových typů pro- gramovacího jazyka C#. Díky použití Source Generátoru je navíc snadno rozšiřitelný o další kategorie náhodných hodnot, jako jsou například jména osob či států. Faker umožňuje stanovit sadu pravidel, na základě kterých je pak možné generovat velké množství pseudonáhodného obsahu požadované struktury. Důraz byl kladen na to, aby bylo API pro stanovování pravidel intuitivní a aby bylo co nejvíce chyb v zápisu pravidel odhaleno již v době překladu. 1
The goal of this thesis was to implement Faker software library capable of filling instances of user defined classes with pseudorandom content and targeting the .NET platform. Requirements the Faker library should fulfill were based on the analysis of existing implementations of similar software libraries for various programming languages. Xoshiro256** PRNG algorithm was chosen to be used as the source of 64-bit long pseudorandom words. Faker uses pseudorandom words produced by xoshiro256** to gene- rate pseudorandom values of all basic data types available in C# programming language. Furthermore, a Source Generator is used to ensure, that the Faker can be easily exten- ded by additional categories of pseudorandom values such as first names, last names or addresses. The Faker allows to set sets of rules describing a required structure of pseudorandom data and it is subsequently capable of generating large amounts of the pseudorandom content with the specified structure. The emphasis was put on making the rule setting API as intuitive as possible and ensuring that the majority of syntactic mistakes made while stating rules is detected at compile time. 1