Create a List of Numbers in Bogus

3k views Asked by At

I need to obtain a list of random positive numbers generated with Bogus.

The returned object should be the IEnumerable<long> type.

This will give a number, is there an easy way to generate a list using Bogus?

var fakeNumber = new Faker().Random.Number(0,10);
1

There are 1 answers

1
Rodrigo Schemes On BEST ANSWER

Following Bogus documentation, using Link solved my problem. The code below gives me a list of 10 positive numbers.

var faker = new Faker();
var listOfNumbers = Enumerable.Range(1, 10).Select(_ => faker.Random.Long(1)).ToList();