Generating random strings, numbers, or data structures, or dealing with random input (e.g., fuzz testing).
Questions tagged [random-data]
22 questions
9
votes
3 answers
How to create a random instance of a case class?
Suppose I've got a few case classes, e.g.:
case class C(c1: Int, c2: Double, c3: Option[String])
case class B(b: Int, cs: Seq[C])
case class A(a: String, bs: Seq[B])
Now I would like to generate a few instances of A with random values for tests.…

Michael
- 41,026
- 70
- 193
- 341
9
votes
2 answers
Generate random latitude-longitude values within an area(country/city)
How can I get thousands of geographic coordinates (long/lat) randomly generated that remains within a specific country ?
It's for an application i'm doing and i need test data.
I preffer it in JSON format.

Xsmael
- 3,624
- 7
- 44
- 60
3
votes
3 answers
How would I generate a random data series in Python with events?
I'm trying to generate a random data series (or a time series) for anomaly detection, with events spanning a few consecutive data points. They could be values above/below a certain threshold, or anomaly types with different known…

lesk_s
- 365
- 1
- 9
3
votes
4 answers
Get random data from SQL Server but no repeated values
I need to get 10 random rows from table at each time, but rows shall never repeat when I repeat the query.
But if I get all rows it will repeat again from one, like table has 20 rows, at first time I get 10 random rows, 2nd time I will need to get…

Manikandan
- 844
- 15
- 31
2
votes
0 answers
Randomizing DataFrame rows
If a create a DataFrame Object, lets say df = pd.DataFrame({'A':range(5), 'B':range(5)}, and try to randomize some rows with df.reindex(np.random.permutation(df.index)) I get
>>> df = pd.DataFrame({'A':range(5), 'B':range(5)})
>>> df
A B
0 0 …

Luis Bonilla
- 21
- 3
1
vote
1 answer
PostMan - Generate random number range and random future date
there are certain discussions on generating random stuff within a range on stack but none of them answer the actual question.
So task is the following
Need to generate a random number within a range, let's say from 1 to 13010, and put this number…

soda432
- 11
- 3
1
vote
2 answers
How to construct a random data set of different year in R?
The code below will generate uniformly distributed data at a daily time step for the year 2009. Suppose, i want to construct a similar data set which would include the year 2009,2012, 2015, and 2019, how would i do that?. I am basically trying to…

Hydro
- 1,057
- 12
- 25
1
vote
1 answer
Generate random bytearray from a distribution
I am looking for a way to generate random bytes sampled from specified underlying distribution. e.g. bytes generated from a normal distribution with given mean and variance, bytes generated from poisson distribution with specified lambda and so…

jvars
- 47
- 5
1
vote
1 answer
Can't cast MockUnit to String with mockneat
Try to use my own Enum like mock with help of library mockneat. But the problem is that I can't take string value from MockUnit object for my right working of switch loop.
It's my Enum:
public enum SubType {
ROUTER("router"),
…

Spike Johnson
- 365
- 4
- 12
1
vote
1 answer
Synthetic Data with range of date & time
I am trying to generate synthetic data with with date & time range. How can I include the needed date-time section in the program mentioned below?
import random
import sys
import math
latitude = 0.794501
longitude = -0.752568
file_n =…

Sitz Blogz
- 1,061
- 6
- 30
- 54
1
vote
2 answers
iPHP Generate 2 letters based on number
I am trying to generate some SKU numbers and I came to an issue that has made me think, and as I slept less than 2 hours I decided to ask you guys, Stackoverflowers.
Let's say I've got an array of the alphabet excluding commonly mistaken…

Dimitar Mitov
- 37
- 2
- 7
0
votes
0 answers
how to generate synthetic data for 2 tables with one-to-many relationship?
how to generate synthetic data for 2 tables with one-to-many relationship?
I have the following problem, I have 2 tables of a bank and I was asked to make up the data.
Table 1 corresponds to the table where the credit card sales information…

Themono99
- 3
- 2
0
votes
1 answer
Generate random inputs using a fuzzer
Let me take a very small example of what I am looking for.
def add_two_numbers(x, y):
return x + y
I want to input n number of times, the random values for x and y.
Is there any python fuzzing library that I can use for generating such values…

Rajiv Bhalla
- 11
- 2
0
votes
1 answer
postgreSQL generate random data for any table
How to generate random data for any table on pgsql in postgresql
CREATE OR REPLACE FUNCTION service.generate_random(sschema_name text, stable_name text, row_count int)

Зверь Зверский
- 11
- 1
0
votes
0 answers
Mockaroo API call in Java
I tried calling Mockaroo API in my JAVA Class as per in Mockaroo Doc,But it shows the
Server returned HTTP response code: 500 for URL
Hereby I have attached my code,
Do I miss the Parameter/any Query Strings?
URL url = new…

Mathi
- 1
- 2