# [Compulsory] Principles of artificial intelligence Learning Notes (1) Chapter1 Introduction

2023-01-04   ES

### 1. Basic

When the reference method is referenced by the placement, mock.mock (‘@boolean’); mock.mock (‘@boolean ()’) can be called

 Method meaning Use for example Random.boolean(num1?,num2?,current?) Return to a random Boolean value The probability of is NUM1/(Num1+NUM2) Mock.mock(‘@boolean()’) Mock.mock(‘@boolean(1,9,true)’) Random.natural(num1?,num2?) Return a natural number of NUM1 and NUM2 contains NUM1 and NUM2 only one parameter is the minimum value Mock.mock(‘@natural()’) Mock.mock(‘@natural(100,99)’) Mock.mock(‘@natural(10)’) Random.integer(num1?,num2?) 11 11 11 (Num1?, Num2?) Difference: The generated integer may be negative numbers Mock.mock(‘@integer()’) … Random.float(num1?,num2?,dnum1?,dnum2?) Return a floating point number, the integer part is from NUM1 and NUM2, and the length of the decimal part is from DNUM1 and DNUM2 Includes NUM1, NUM2, DNUM1, DNUM2 When the floating point number exists, both NUM1 and NUM2 must exist can only exist only NUM1 or only Num1, NUM2, DNUM1 Mock.mock(‘@float()’) Mock.mock(‘@float(1,100)’) Mock.mock(‘@float(1,100,3,5)’) Mock.mock(‘@float(1,100,3)’) Random.character(pool?/type?) Generate a character Type can be: LOWER (lowercase), upper (uppercase), number (number), symbol (symbol), randomly produce a character that meets the type of character POOL: Is a string, the return value is any character of the string Mock.mock(‘@character()’) Mock.mock(‘@character(“lower”)’) Mock.mock(‘@character(“[email protected]“)’) Random.string(pool?/type?, num1?,num2?) Generate a string, between Num1 and NUM2 Type’s rules are the same as above, and a string produces a string. POOL: It will be randomly selected from the POOL string as a new string as a new string When there is only one NUM1, it is a string that generates NUM1 characters in accordance with the rules; When neither NUM1 and NUM2 do not exist, the generated string is empty Mock.mock(‘@string()’) Mock.mock(‘@string(“lower”,3,5)’) Mock.mock(‘@string(“qazwsxedc”,3,5)’) Mock.mock(‘@string(“lower”,3)’) Mock.mock(‘@string(“qazwsxedc”)’) Random.range(start,stop?,step?) Generate a array, the array contains numbers that meet the conditions, and the start must exist When there are only starts and stops, starting from Start to the end of Stop, but excluding stop; length is stop-start When STEP exists, starting from the start, the number of steps jumping at each time is not 1 but STEP, to the end of the stop, but excluding stop; the length is (Stop-Start)/Step Mock.mock(‘@range(10)’) Mock.mock(‘@range(10,50)’) Mock.mock(‘@range(10,50,5)’)

### 2. Date

 method meaning Use for example Random.date(format?) Date string that meets Format format default format: ‘yyyy-mm-dd’ format format: ‘yyyy-mm-dd’; ‘yy-mm-dd’; ‘y-mm-dd’; ‘y-m-d’ PS: M should be uppercase; for ‘y-m-d’, if it is a digit-digit, it is omitted. If it is two digits, Mock.mock(‘@date()’) Mock.mock(‘@date(yy-MM-dd)’) Random.time(format?) Generate event string that meets Format format default format: ‘Hh: mm: ss’ format format: ‘a hh: mm: ss’; ‘a hh: mm: ss’; ‘hh: mm: ss’; ‘h: m: s’; millisecond h means 24 -bit count, H indicates 12 digits; a represents PM; A represents AM; ‘h: m: s’ indicates that when there are ten digits, it is omitted when there are The order of the generated data corresponds; one or more time format can be omitted Mock.mock(‘@time()’) Mock.mock(‘@time(“A HH:mm:ss”)’) Mock.mock(‘@time(“H:m:s”)’) Mock.mock(‘@time(“h”)’) Random.datetime(format?) String of the date and time that meets the format format Format here is equivalent to the combination of random.date () and random.tiem (). Mock.mock(‘@datetime()’) Mock.mock(‘@datetime(“yyyy-MM-dd A HH:mm:ss”)’) Random.now(unit?,format?) Form a string that meets the current date and time that meets Format default format: ‘yyyy-mm-dd HH: mm: ss’ Unit is used to specify which stage of formatting to, and the stages behind Unit are initialized to 0 or 1 4 4: ‘Year’; ‘Month’; ‘Week’; ‘Day’; ‘Hour’; ‘Minute’; ‘Second’ When the unit and format exist at the same time, it is the dual editing of the format of multiple output date Mock.mock(‘@now()’) Mock.mock(‘@now(“yyyy-MM-dd A HH:mm:ss”)’) Mock.mock(‘@now(“year”)’) 　　”2018-01-01 00:00:00″ Mock.mock(‘@now(“day”,”yyyy-MM-dd A HH:mm:ss”)’)

### 3. Color

 method meaning Use for example Random.color() Randomly generate a hexadecimal color Mock.mock(‘@color()’) Random.hex() Same as above; unclear difference Mock.mock(‘@hex()’) Random.rgb() Randomly generate a color of an RBG format Mock.mock(‘@rgb()’) Random.rgba() Randomly generate a color of a RGBA format, which will be transparent Mock.mock(‘@rgba()’) Random.hsl() Randomly generate the color of HSL format, H-S-L is the industrial color standard, according to the hue (H)-saturation (s)-brightness (L) Mock.mock(‘@hsl()’)

Reprinted: https://www.cnblogs.com/waterfowl/p/9708777.html

source