File tree Expand file tree Collapse file tree 1 file changed +6
-10
lines changed Expand file tree Collapse file tree 1 file changed +6
-10
lines changed Original file line number Diff line number Diff line change @@ -324,19 +324,15 @@ export class Datatype {
324
324
throw new FakerError ( `Max ${ max } should be larger then min ${ min } .` ) ;
325
325
}
326
326
327
- // TODO @Shinigami 92 2022-04-07: Use faker.random.numeric() from https://github.com/faker-js/faker/pull/797
328
- const generateRandomBigInt = ( length : number ) =>
329
- BigInt (
330
- Array . from (
331
- { length } ,
332
- ( ) => '0123456789' . split ( '' ) [ this . number ( { min : 0 , max : 9 } ) ]
333
- ) . join ( '' )
334
- ) ;
335
-
336
327
const delta = max - min ;
337
328
338
329
const offset =
339
- generateRandomBigInt ( delta . toString ( 10 ) . length ) % ( delta + BigInt ( 1 ) ) ;
330
+ BigInt (
331
+ this . faker . random . numeric ( delta . toString ( 10 ) . length , {
332
+ allowLeadingZeros : true ,
333
+ } )
334
+ ) %
335
+ ( delta + BigInt ( 1 ) ) ;
340
336
341
337
return min + offset ;
342
338
}
You can’t perform that action at this time.
0 commit comments