deterministic

Having problems keeping a simulation deterministic with random.Random(0) in python

柔情痞子 提交于 2020-01-06 03:25:50
问题 I have a very large simulation in python with lots of modules. I call a lot of random functions. To keep the same random results I have a variable keep_seed_random. As so: import random keep_seed_random = True if keep_seed_random is False: fixed_seed = random.Random(0) else: fixed_seed = random Then I use fixed_seed all over the program, such as fixed_seed.choice(['male', 'female']) fixed_seed.randint() fixed_seed.gammavariate(3, 3) fixed_seed.random() fixed_seed.randrange(20, 40) and so on..

Is there any way to make this UDF deterministic?

风格不统一 提交于 2020-01-03 17:13:23
问题 I assume this is not deterministic simply because DB_NAME() is not deterministic? If DB_NAME() is not deterministic, why is it not deterministic? ALTER FUNCTION [TheSchema].[udf_IS_PRODUCTION] () RETURNS bit WITH SCHEMABINDING AS BEGIN RETURN CASE WHEN DB_NAME() = 'PRODUCTION' THEN CONVERT(bit, 1) ELSE CONVERT(bit, 0) END END Update: This version works, is deterministic, allows the same code to be used in any database and removes the hardcoding of the database name (which also allows me to

What is a Deterministic Quicksort?

流过昼夜 提交于 2020-01-02 01:04:18
问题 I have been reading about Quicksort and found that sometimes it' s referred to as "Deterministic Quicksort". Is this an alternate version of the normal Quicksort ? What is the difference between a normal Quicksort and a Deterministic Quicksort ? 回答1: The ordinary ("deterministic") Quicksort can have very poor behaviour on particular datasets (as an example, an implementation that picks the first unsorted element has O(n^2) time complexity on already-sorted data). Randomized Quicksort (which

Oracle execution plans when using the LIKE operator with a DETERMINISTIC function

梦想的初衷 提交于 2019-12-30 11:32:22
问题 Now I have a really tricky thing with Oracle execution plans running havoc, when I use a DETERMINISTIC function on the right hand side of the LIKE operator. This is my situation: The Situation I thought it to be wise to execute a query like this (simplified): SELECT [...] FROM customers cust JOIN addresses addr ON addr.cust_id = cust.id WHERE special_char_filter(cust.surname) like special_char_filter(?) And I would bind ? to something like 'Eder%' . Now customers and addresses are very large

What could cause a deterministic process to generate floating point errors

独自空忆成欢 提交于 2019-12-29 06:23:06
问题 Having already read this question I'm reasonably certain that a given process using floating point arithmatic with the same input (on the same hardware, compiled with the same compiler) should be deterministic. I'm looking at a case where this isn't true and trying to determine what could have caused this. I've compiled an executable and I'm feeding it the exact same data, running on a single machine (non-multithreaded) but I'm getting errors of about 3.814697265625e-06 which after careful

How to create a CNN with deterministic operations in TensorFlow on a GPU?

强颜欢笑 提交于 2019-12-24 08:46:24
问题 So after I realize there are operations in TensorFlow which are non-deterministic, see this Question: How to get the same loss value, every time training a CNN (MNIST data set), with TensorFlow?, I want to know: How can I build a convolutional neural net with: TensorFlow Version 1.1.0 CUDA release 8.0, V8.0.61 cuDNN 5.1.10 run on GPU which use only deterministic operations? 回答1: You can't until every operation on cuDNN is not completely deterministic. Moreover, even moving every operation on

Are floating point operations in Delphi deterministic?

喜欢而已 提交于 2019-12-23 08:56:38
问题 Are floating point operations in Delphi deterministic? I.E. will I get the same result from an identical floating point mathematical operation on the same executable compiled with Delphi Win32 compiler as I would with the Win64 compiler, or the OS X compiler, or the iOS compiler, or the Android compiler? This is a crucial question as I'm implementing multiplayer support in my game engine, and I'm concerned that the predictive results on the client side could very often differ from the

Can I make a Deterministic Shuffle in clojure?

你离开我真会死。 提交于 2019-12-23 07:29:51
问题 I'd like to make some shuffles of sets which will be the same every time my program is run: This is one way to do it: (def colours ["red" "blue" "green" "yellow" "cyan" "magenta" "black" "white"]) (defn colour-shuffle [n] (let [cs (nth (clojure.math.combinatorics/permutations colours) n)] [(first cs) (drop 1 cs)])) ; use (rand-int 40320) to make up numbers, then hard code: (def colour-shuffle-39038 (colour-shuffle 39038)) (def colour-shuffle-28193 (colour-shuffle 28193)) (def colour-shuffle

Split a string based on each time a Deterministic Finite Automata reaches a final state?

丶灬走出姿态 提交于 2019-12-21 22:28:54
问题 I have a problem which has an solution that can be solved by iteration, but I'm wondering if there's a more elegant solution using regular expressions and split() I have a string (which excel is putting on the clipboard), which is, in essence, comma delimited. The caveat is that when the cell values contain a comma, the whole cell is surrounded with quotation marks (presumably to escape the commas within that string). An example string is as follows: 123,12,"12,345",834,54,"1,111","98,273","1

Is Box2D perfectly deterministic?

送分小仙女□ 提交于 2019-12-21 19:28:11
问题 I'm writing an Android game using LibGDX and Box2D. I'm planning on adding a turn-based multiplayer feature to it. Now, if on both clients I step the Box2D world at the same rate with the same time steps and I start a simulation on both clients with the exact same initial parameters, when the simulations are over, will the final state of both simulations be exactly the same? In other words, is a Box2D simulation perfectly deterministic? If it's not, then that means every time a simulation is