Ticket #326 (closed bug: fixed)

Opened 6 years ago

Last modified 5 years ago

orange.RandomGenerator daje enake vrednosti za pare seedov

Reported by: marko Owned by: janez
Milestone: Future Component: library
Severity: major Keywords:
Cc: Blocking:
Blocked By:

Description

orange.RandomGenerator(0) je enak orange.RandomGenerator(1), orange.RandomGenerator(2) je enak orange.RandomGenerator(3), ...

Če je to zaželeno obnašanje, bi bilo fino, da bi bilo dokumentirano.

Spodnja koda

import orange

for randseed in range(10):
    gen = orange.RandomGenerator(randseed)
    print randseed, [ gen() for a in range(5) ]

vrne

0 [-498792314, -112437510, -2114916689, -485586824, -1334173636]
1 [-498792314, -112437510, -2114916689, -485586824, -1334173636]
2 [-1676387910, -1762499797, -272906294, -1944289993, -149761223]
3 [-1676387910, -1762499797, -272906294, -1944289993, -149761223]
4 [530851887, 220897967, -351680601, -348297927, 657775876]
5 [530851887, 220897967, -351680601, -348297927, 657775876]
6 [-758443522, -1659529737, 511778202, 1189278158, 1406824411]
7 [-758443522, -1659529737, 511778202, 1189278158, 1406824411]
8 [-1235856076, 1103010433, -584101311, -1317330743, 124816201]
9 [-1235856076, 1103010433, -584101311, -1317330743, 124816201]

Change History

comment:1 Changed 5 years ago by janez

  • Status changed from new to closed
  • Resolution set to fixed

Misliš, da je to povezano s tem, da v inicializaciji generatorja (ki ga nisem pisal jaz) najprej reče tole? :)

unsigned long x = (seed | 1)

Zdaj pomnožim seed z 2, preden ga dam generatorju.

Note: See TracTickets for help on using tickets.