11
$\begingroup$

Bug introduced in 11.0.1 or earlier and fixed in 11.1


This seems like a pretty awful bug:

SeedRandom[1];
RandomInteger[10, 10]

Out: {1,4,0,7,0,0,8,6,0,4}

While:

SeedRandom[1];
Dataset[<|a -> 1, b -> 2|>];
RandomInteger[10, 10]

Out: {7,0,0,8,6,0,4,1,8,5}

I see this with 11.0.1 on Linux, OS X, and Windows. Am I missing something?

$\endgroup$
  • 4
    $\begingroup$ @Kuba, but then, those built-in symbols ought to have wrapped things in BlockRandom[] to prevent such interference. $\endgroup$ – J. M. will be back soon Jan 27 '17 at 13:59
  • 1
    $\begingroup$ Also re: using SeedRandom right before calling the random function, I don't think that's the only use case. For example I have a whole series of random calls that I'm making, and I usually just put a single SeedRandom at the very top to guarantee determinism. Having to place a SeedRandom in front of every random call seems rather ugly, and may actually result in worse randomization in some cases. $\endgroup$ – Mohammed AlQuraishi Jan 27 '17 at 14:45
  • 5
    $\begingroup$ Agree it's a bug. I bet that DataSet is using some random numbers under the hood to build a hash table. $\endgroup$ – Kelly Lowder Jan 27 '17 at 15:08
  • 2
    $\begingroup$ A (grotesque) workaround: SeedRandom[1]; BlockRandom[Dataset[<|a -> 1, b -> 2|>]]; RandomInteger[10, 10]. $\endgroup$ – J. M. will be back soon Jan 27 '17 at 15:44
  • 2
    $\begingroup$ If it is an intended behaviour (and I can't see why it should be) it should at least be documented (e.g. in the "Possible Issues") $\endgroup$ – mikado Jan 27 '17 at 18:20
3
$\begingroup$

This is fixed in 11.1.

$Version
SeedRandom[1];
Dataset[<|a -> 1, b -> 2|>];
RandomInteger[10, 10]

11.1.0 for Microsoft Windows (64-bit) (March 13, 2017)

{1, 4, 0, 7, 0, 0, 8, 6, 0, 4}

$\endgroup$

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.