Seed is a JavaScript interpreter and a library of the GNOME project.
Questions tagged [seed]
632 questions
189
votes
12 answers
Seedable JavaScript random number generator
The JavaScript Math.random() function returns a random value between 0 and 1, automatically seeded based on the current time (similar to Java I believe). However, I don't think there's any way to set you own seed for it.
How can I make a random…

scunliffe
- 62,582
- 25
- 126
- 161
131
votes
8 answers
How to load db:seed data into test database automatically?
I'm attempting to use the new standard way of loading seed data in Rails 2.3.4+, the db:seed rake task.
I'm loading constant data, which is required for my application to really function correctly.
What's the best way to get the db:seed task to run…

Luke Francl
- 31,028
- 18
- 69
- 91
117
votes
9 answers
set random seed programwide in python
I have a rather big program, where I use functions from the random module in different files. I would like to be able to set the random seed once, at one place, to make the program always return the same results. Can that even be achieved in python?

Mischa Obrecht
- 2,737
- 6
- 21
- 31
106
votes
2 answers
How to seed data with AddOrUpdate with a complex key in EF 4.3
I am trying to seed a development database with some test data.
I have used context.People.AddOrUpdate(p => p.Id, people)); with much success.
I have another table that I need to seed, in which I would not know the primary key.
For example, I would…

Keith Sirmons
- 8,271
- 15
- 52
- 75
88
votes
7 answers
What is the best way to seed a database in Rails?
I have a rake task that populates some initial data in my rails app. For example, countries, states, mobile carriers, etc.
The way I have it set up now, is I have a bunch of create statements in files in /db/fixtures and a rake task that processes…

Tony
- 18,776
- 31
- 129
- 193
80
votes
3 answers
Adding a custom seed file
I want to populate a new feature with dummy data, but don't want to use the db/seeds.rb file as it already has seeds other data irrelevant for this feature.
To run the default seeds.rb file, you run the command rake db:seed.
If I create a file in…

Fellow Stranger
- 32,129
- 35
- 168
- 232
76
votes
2 answers
How to re-seed a table identity in SQL Server 2008 and undo it all safely?
I need to do this for testing only, but then undo it when the test is done.
I have seen some tutorials online on how to re-seed a table, but not so much on how to undo it.
Let's say the table definition is the following:
create table beer
(
beer_id…

Hamish Grubijan
- 10,562
- 23
- 99
- 147
69
votes
7 answers
how to query seed used by random.random()?
Is there any way to find out what seed Python used to seed its random number generator?
I know I can specify my own seed, but I'm quite happy with Python managing it. But, I do want to know what seed it used, so that if I like the results I'm…

mix
- 6,943
- 15
- 61
- 90
66
votes
8 answers
Seed multiple rows at once laravel 5
I'm currently trying to seed my users table. If I try it like this with 2 rows, it fails. It works fine if I just use a single array instead of the 2 arrays inside the $users array to create some fake data.
What am I doing wrong, what is the proper…

Stephan-v
- 19,255
- 31
- 115
- 201
62
votes
7 answers
Java random numbers using a seed
This is my code to generate random numbers using a seed as an argument:
double randomGenerator(long seed) {
Random generator = new Random(seed);
double num = generator.nextDouble() * (0.5);
return num;
}
Every time I give a seed and…

Rahul Bhatia
- 1,005
- 2
- 13
- 18
47
votes
2 answers
Can I somehow execute my db/seeds.rb file from my rails app?
I am building a demo, and I want to make it very easy for a non-technical person to set up and run the demo. I have built a seeds.rb file with lots of demo data in it. I want to be able to reset the rails app to a known state by providing an…

explainer
- 1,345
- 3
- 11
- 25
44
votes
5 answers
How to seed Django project ? - insert a bunch of data into the project for initialization
I'ved been developing in Django and was wondering if there is a way to seed data into the database in Django.
In ruby on rails, I use seed.rb and then run "rake db:seed" in command line.
Main reason I want to seed some data on statuses, types, etc…

Axil
- 3,606
- 10
- 62
- 136
37
votes
5 answers
How to seed the production database using the Capistrano gem?
I am using Ruby on Rails 3.0.9 and I would like to seed the production database in order to add some record without re-building all the database (that is, without delete all existing records but just adding some of those not existing yet). I would…

Backo
- 18,291
- 27
- 103
- 170
36
votes
12 answers
Randomize a PHP array with a seed?
I'm looking for a function that I can pass an array and a seed to in PHP and get back a "randomized" array. If I passed the same array and same seed again, I would get the same output.
I've tried this code
//sample array
$test =…

cwd
- 53,018
- 53
- 161
- 198
36
votes
6 answers
In Laravel, how do I retrieve a random user_id from the Users table for Model Factory seeding data generation?
Currently, in my ModelFactory.php, I have:
$factory->define(App\Reply::class, function (Faker\Generator $faker) {
return [
'thread_id' => 1,
'user_id' => 1,
'body' => $faker->paragraph
];
});
I would like to generate a random…

Simon Suh
- 10,599
- 25
- 86
- 110