py_randint.miaou
← Le code · src/outil/miaou/py_randint.miaou · 21 lignes
(node py_randint
(params (m Mt) (a Grand) (b Grand))
(returns Grm)
(intent "randint(a, b) de Python : a plus _randbelow(b - a + 1)")
(origin "phase 8f6 : le hasard de Python en miaou, d'après py_randint de l'outil inter (random.Random de Python)")
(effects)
(uses py_sous gr_add gr_sub gr_de_nat)
(requires
true)
(ensures
true)
(examples
(ex ((record Mt (mots (list 0 0)) (i 0)) (record Grand (neg false) (mots (list 4))) (record Grand (neg false) (mots (list 4))))
(record Grm
(g (record Grand (neg false) (mots (list 4))))
(mt (record Mt (mots (list 0 0)) (i 1))))))
(equivalence exact)
(body.high
(let ((r (py_sous m (gr_add (gr_sub b a) (gr_de_nat 1)) 100000)))
(record Grm (g (gr_add a (get r g))) (mt (get r mt)))))
(end node py_randint))