seed

Independent instances of 'random'

The below code attempts to illustrate what I want. I basically want two instances of "random" that operate independently of each other. I want to seed "random" within one class without affecting "random" in another class. How can I do that? class RandomSeeded: def __init__(self, seed): import random as r1 self.random...

Rails DB seed with yml files sometimes removes and re-adds existing records, sometimes not. What gives?

I have a rails project with seeds that are executed using rake db:seed. This in turn loads the RB files in the db/seeds directory which in turn executes something like this: Fixtures.create_fixtures("db/seeds","projects") There is a projects.yml in the form project_name1: property: value project_name2: property: value In the ...

Seeding a restful_authentication user in seeds.rb

I'm pretty sure I understand how seeding work with respect to seeds.rb, but I can't seem to use it to stick a restful_authentication User object into the database. User.create(:login => 'admin', :role => Role.find_by_name('super_admin'), :email => '[email protected]', :password => '123123') Am I mis...

Creating a torrent file with monotorrent: How do I add webseeds?

I have been looking at monotorrent and while investigating the whole bittorrent thing I saw that a torrent file may also specify web seeds, which are basically standard HTTP downloads but which can work e.g. as an initial seed. I have also seen in the release notes of monotorrent 0.8 that they Added the ability to easily add webseed...

How can I store the state of the pseudo-random generator in Perl?

Is there a way to store the current state of the built in pseudo-random number generator in Perl so that when my program is run again, it can pick up the sequence from where it left off rather than starting with a new sequence? Right now, I am storing where I am as well as the initial seed and then throwing away the initial segment whic...

Best seed for parallel process

I need to run a MonteCarlo simulations in parallel on different machines. The code is in c++, but the program is set up and launched with a python script that set a lot of things, in particular the random seed. The function setseed thake a 4 bytes unsigned integer Using a simple import time setseed(int(time.time())) is not very good ...

in regard to recursion what is a seed value?

in regard to recursion what is a seed value? ...

can't use db:seed in rails

I updated my rails gem to 2.3.5 but I keep getting this error when running db:seed: $ rake db:seed --trace (in c:/Documents and Settings/Owner/workspace/thepatstudio) rake aborted! Don't know how to build task 'db:seed' c:/Ruby/lib/ruby/gems/1.8/gems/rake-0.8.7/lib/rake.rb:1728:in `[]' c:/Ruby/lib/ruby/gems/1.8/gems/rake-0.8.7/lib/rake....

Rails Load Data into Application every time a New User is Created

Hi I am trying to figure out the "right" way to do this. In my application every time I create a new user I want to have specific data loaded into an associated table. The associated table is a different preset lists. So a User has many lists and those lists have many items. Some of those Items I want to be loaded when the User is creat...

Large free block of english non-pronoun text

As part of teaching myself python I've written a script which allows a user to play hangman. At the moment, the hangman word to be guessed is simply entered manually at the start of the script's code. I want instead for the script to choose randomly from a large list of english words. This I know how to do - my problem is finding that l...

c++ generate a good random seed for psudo random number generators

I am trying to generate a good random seed for a psudo-random number generator. I thought I'd get the expert's opinions. let me know if this is a bad way of doing it or if there are much better ways. #include <iostream> #include <cstdlib> #include <fstream> #include <ctime> unsigned int good_seed() { unsigned int random_seed, ran...

Can database Schemas help improve performance?

I have a normalized Database. And i have like 150 Clients that connect to this database and use it as an application. I am wondering if Schemas would make the queries run any faster. Simply because I ran a query on a stripped down database and it ran fast and i ran it on my live database and it was much slower. Also If i implemented...

Seed data for grails application

Hello, What is the best way to load seed (initial or test) data into grails application. I'm considering 3 options Putting everything in *BootStrap.groovy files. This is tedious if the domain classes and test data are many. Write custom functionality to load it through xml. May not be too difficult with the excellent xml support ...

Separate seeds in PHPUnit

How do I create a separate seed for some test inside one test class? PHPUnit documentation includes this example <?php require_once 'PHPUnit/Extensions/Database/TestCase.php'; class DatabaseTest extends PHPUnit_Extensions_Database_TestCase { protected function getConnection() { $pdo = new PDO('mysql:host=localhost;dbna...

Seeding a Rails Database with Pre-set IDs

I have an XML file containing seed data that I'm trying to load into my production database. The problem being that I have associations between different data types / nodes in the XML file, and so I need the specified IDs to be the same when loaded into MySQL from Rails. This works fine with SQLite during development, I just use a line...

Set seed on Math.random()

Hi - I need to write some junit tests on java code that calls Math.random(). I know that I can set the seed if I was instantiating my own Random object to produce repeatable results. Is there a way to do this also for Math.random() ? ...

What can I do with Seed?

I found Seed, which is basically a JavaScript environment and binding for programming GTK+. Are there any limitations compared to using e.g. C and C++? Are there any major speed concerns? ...

How can i get the seed value of an identity column in MySql

To get the seed and step values of an identity column in sql server i can use this syntax SELECT ColumnName = name, Seed = seed_value, Step = increment_value FROM sys.identity_columns So far in MySql i have found that if i use this syntax SELECT * FROM INFORMATION_SCHEMA.TABLES WHERE auto_increment IS NOT NULL I can at least fi...

How to force SQL Server 2008 to not change AUTOINC_NEXT value when IDENTITY_INSERT is ON ?

Hello, I got question about IDENTITY_INSERT. When you change it to ON, SQL Server automatically changes AUTOINC_NEXT value to the last inserted value as identity. So if you got only one row with ID = 1 and insert row with ID = 100 while IDENTITY_INSERT is ON then next inserting row will have ID = 101. I'd like it to be 2 without need ...

Ruby on Rails: How do you seed the *_type column in polymorphic models?

I have a lot of data that I'm trying to seed into a polymorphic model in Rails 2.3.8. The association for all of the data is with the County model. The data looks like: data = Datum.create([ ... { :value => '14389', :value_type => County, :value_id =>'3103'}, { :value => '59013', :value_type => County, :value_id =>'3105'}, { :va...