de en es fr
Let the machine help
Light teasing, exhibition, BDSM, sissyfication, watersports... with sounds and pictures


Post new topic Reply to topic  [ 3 posts ] 
Author Message
 Probability
PostPosted: Sat Oct 22, 2011 7:17 pm 
Offline
Regular
If you have 4 or 5 random things that might be assigned is there a way to weigh it so that one might be much more likely or less likely than the others, other than using multiple examples of each outcome and just having more of the one you want more likely?

Right now I have it set up to have a random outcome of 4 possible choices but the probability of each is 1 in 4. Can it be changed so that I can either set probablity for each at least for one specifically?


Top
 Profile Send private message 
 
 Re: Probability
PostPosted: Sat Oct 22, 2011 7:36 pm 
Offline
Site Admin
User avatar
Yes of course. Let's say we want this
--1--|-2-|------3------|--4--
(width here is proportionnal to weigth)

We'll write this:
Code:
   def r = getRandom(100)
   if(r<15) show("...punishment 1...") //15%
   else if(r<25) show("...punishement 2...") //10%
   else if(r<85) show("...punishement 3...") //60%
   else show("...punishement 4...") //15%

("//..." : comment, ignored by Groovy engine)


Top
 Profile Send private message 
 
 Re: Probability
PostPosted: Sat Oct 22, 2011 9:24 pm 
Offline
Regular
Thank you. Makes sense.


Top
 Profile Send private message 
 
Display posts from previous:  Sort by  
Post new topic Reply to topic  [ 3 posts ] 

All times are UTC + 1 hour [ DST ]


Who is online

Users browsing this forum: No registered users and 8 guests


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot post attachments in this forum

Search for:
Jump to:  


Powered by phpBB © 2000, 2002, 2005, 2007 phpBB Group
Maroon Fusion theme created by Oxydo
Software, theme modifications, phpBB modification by Doti 2010 - 2020
This website uses session cookies only.