Questions tagged [deterministic]

The system or program exhibits the same behavior in different runs.

The system or program exhibits the same behavior on different runs. This is opposed to .

353 questions
4
votes
1 answer

Code for member/2 with some Determinism

How can I code member/2 that has determinism for the last element. Currently I am using: member(X,[X|_]). member(X,[_|Y]) :- member(X,Y). When I query the following: ?- member(X,[1,2]). X = 1 ; X = 2 ; No The interpreter continues searching after…
user502187
4
votes
1 answer

Determinism in C++ standard library

std::sort is not guaranteed to be stable. Is it guaranteed to be deterministic though? For example, will this code always print 1? struct S { int a, b; }; bool cmp(const S& lhs, const S& rhs) { return lhs.a < rhs.a; } int main() { …
Phastasm
  • 894
  • 1
  • 7
  • 8
4
votes
1 answer

Generate the same sequence of random numbers in C++ from a given seed

I am using mt19937 to generate a random string from a given seed like this: std::string StringUtils::randstring(size_t length, uint64_t seed) { static auto& chrs = "abcdefghijklmnopqrstuvwxyz"; thread_local static std::mt19937 rg(seed); …
jeffreyveon
  • 13,400
  • 18
  • 79
  • 129
4
votes
1 answer

Why does hashing an F# record return a different value on each run

I'm trying to create a simple on-disk cache, but each time I run the application my structurally equal records have a different hash value. The behavior seems to be correct (deterministic) when I run it in LINQPad or if the record only contains an…
Alex K
  • 59
  • 3
4
votes
0 answers

how to 'reset' random sequence in tensorflow

I have a graph with GBs of variables, and a random function (e.g. VAE). I'd like to be able to run a function, and always use the same random sequence (e.g. feed a large number of x, and always get the exact same z and y). I can achieve this using…
memo
  • 3,554
  • 4
  • 31
  • 36
4
votes
1 answer

TensorFlow - reproducing results when using dropout

I am training a neural network using dropout regularization. I save the weights and biases the network is initialized with, so that I can repeat the experiment when I get good results. However, the use of dropout introduces some randomness in the…
4
votes
1 answer

Is the order of iteration for javascript array methods (map, forEach, reduce, etc) deterministic?

Is the order of iterating through an array using one of the native methods (map, forEach, reduce, filter, etc) deterministic and guaranteed by the standard? EG, are foo, bar, baz, and qux guaranteed to be [0, 2, 6, 12]? const a = [1, 2, 3, 4]; const…
4
votes
1 answer

Is Jenks' Natural Breaks deterministic?

i.e., will the algorithm always return the same result (for a 1D list of numbers)? Is Fisher's Natural Breaks (the O(knlog(n)) optimization of Jenks') deterministic?
4
votes
2 answers

How to make memory allocation in MSVC C++ deterministic?

While debugging some C++ code with tons of pointers it would be useful if the memory addresses between runs were the same. Is there any way to make the series of addresses that are returned between consecutive runs of a program that perform the same…
Joe
  • 2,008
  • 1
  • 17
  • 25
4
votes
1 answer

Deterministic shuffle in Objective C

This code in Java is the implementation of Knuth's shuffle, but a deterministic one, controllable by the seed to the random number generator. public String shuffleString(String data, long shuffleSeed) { if(shuffleSeed!=0) { Random rnd =…
xtremebytes
  • 173
  • 1
  • 14
4
votes
1 answer

User-Defined Functions SQL Server 2005 flagged incorrectly as non-deterministic?

Related to this question, I decided to check the UDFs in my data warehouse (which should largely have been deterministic), and I found several which aren't which should be. For instance: CREATE FUNCTION [udf_YearFromDataDtID] ( @DATA_DT_ID…
Cade Roux
  • 88,164
  • 40
  • 182
  • 265
4
votes
2 answers

Why is [date] + ([time] - [offset]) non-deterministic in SQL Server 2008?

I'm trying to do the following for my IIS logs table: ALTER TABLE [W3CLog] ADD [LogTime] AS [date] + ([time] - '1900-01-01') PERSISTED However, SQL Server 2008 tells me: Computed column 'LogTime' in table 'W3CLog' cannot be persisted because the…
John Gietzen
  • 48,783
  • 32
  • 145
  • 190
4
votes
4 answers

Is there any way to make this UDF deterministic?

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 …
Cade Roux
  • 88,164
  • 40
  • 182
  • 265
4
votes
1 answer

Time complexity of a Turing machine for repeat strings

I'm trying to figure out the time-complexity of a turing machine that accepts repeat strings (ww) in three cases: a 1-tape deterministic machine, a 2-tape deterministic machine, and 1-tape nondeterministic machine. Right now my thoughts are that…
4
votes
4 answers

Most secure way to cipher a boolean using a deterministic algorithm?

In one of my school works I am required to use a Deterministic algorithm (http://en.wikipedia.org/wiki/Deterministic_encryption) to cipher several fields. In this specific case I have to cipher a table with booleans. This would be fine, except that…
Flame_Phoenix
  • 16,489
  • 37
  • 131
  • 266