2
$\begingroup$

Why does FindInstance[x>0,x] give 27? I would think it would give 1… maybe 2 or some small positive decimal.

$\endgroup$
2
  • 9
    $\begingroup$ What a missed opportunity to return 42! $\endgroup$ Commented Jul 12, 2024 at 17:45
  • 2
    $\begingroup$ Because as Options[FindInstance] shows, the default RandomSeeding is 1234 $\endgroup$ Commented Jul 12, 2024 at 19:33

1 Answer 1

7
$\begingroup$

Because it uses built-in random seed. You can change it as follows

  FindInstance[x > 0, x, RandomSeeding -> 1]
  (* 81 *)

  FindInstance[x > 0, x, RandomSeeding -> 555]
  (* 100 *)

To get 27 use the builtin value:

  FindInstance[x > 0, x, RandomSeeding -> 1234]
  (* 27 *)

think it would give 1

To get one do

 FindInstance[x > 0, x, RandomSeeding -> 5]
 (* 1 *)

What a missed opportunity to return 42!

 FindInstance[x > 0, x, RandomSeeding -> 35]
 (* 42 *)
$\endgroup$
1
  • 2
    $\begingroup$ It looks like it's the same as RandomInteger[{1, 101}]. On the other hand, FindInstance[x >= 0, RandomSeeding -> something] returns numbers from 0 to 101, but returns 0 about half of the time and 1..101 about half of the time. $\endgroup$ Commented Jul 12, 2024 at 17:57

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.