# -*- coding: utf-8 -*- ##------------------------------------------####### # Experience # ##------------------------------------------####### # WxGeometrie # Dynamic geometry, graph plotter, and more for french mathematic teachers. # Copyright (C) 2005-2013 Nicolas Pourcelot # # This program is free software; you can redistribute it and/or modify # it under the terms of the GNU General Public License as published by # the Free Software Foundation; either version 2 of the License, or # (at your option) any later version. # # This program is distributed in the hope that it will be useful, # but WITHOUT ANY WARRANTY; without even the implied warranty of # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the # GNU General Public License for more details. # # You should have received a copy of the GNU General Public License # along with this program; if not, write to the Free Software # Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA from PyQt5.QtWidgets import (QSpinBox, QCheckBox, QPushButton, QVBoxLayout, QLabel, QHBoxLayout, QLineEdit) from numpy.random import rand import math from numpy import sum # NB: numpy.sum est 100 fois plus rapide que __builtin__.sum ! from ...GUI.qtlib import MyMiniFrame from ...pylib import msplit ent = int def alea(n = None): """Nombre entier aléatoire compris entre 0 et n-1. Si n = None, nombre décimal entre 0 et 1.""" if n == None: return rand() return int(n*rand()) def de(k = 1): return sum(1+(6*rand(k)).astype(int)) def sondage(pourcentage = 50, k = 1000): pourcentage /= 100. return 100.*sum(rand(k)