Commit 6298f061 authored by LammLukas's avatar LammLukas

Added generate_random_participant and generate_random_participant_list to participant class

parent c393a9d7
......@@ -4,7 +4,8 @@ Parent class for participant objects.
Author: L. Lamm (lamm@ifam.rwth-aachen.de)
"""
from src.exportable import Exportable
from randomuser import RandomUser
from random import randint
class Participant(Exportable):
"""Class for object of type Participant"""
......@@ -23,3 +24,20 @@ class Participant(Exportable):
self.Grade = 0
self.Bonus = 0
self.Annotation = ""
@staticmethod
def generate_random_participant():
"""Generates a random participant using randomuser package"""
user = RandomUser()
participant = Participant(firstname=user.get_first_name(),
lastname=user.get_last_name(),
number_of_trials=randint(1,3),
matriculation=randint(300000, 500000))
return participant
@staticmethod
def generate_random_participant_list(num_participants):
lst = []
for i in range(0, num_participants-1):
lst.append(Participant.generate_random_participant())
return lst
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment