Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 7810923
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 2, 20262026-06-02T03:58:06+00:00 2026-06-02T03:58:06+00:00

Going over some old code <!— RANDOMLY DECIDE IS THIS PERSONS A WINNER 1

  • 0

Going over some old code

<!--- RANDOMLY DECIDE IS THIS PERSONS A WINNER 1 IN 8 CHANCE--->
<cfset attributes.random_point = RandRange(1, 8)>

<cfif attributes.random_point eq 5>
  WINNER
<cfelse>
  You got nothing!
</cfif>

How do I convert this to decimal odds? From now on I want to use the decimal odds to determine the change of getting x. So for example I have a 1.10 chance or 1.11 chance of getting x.

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-02T03:58:07+00:00Added an answer on June 2, 2026 at 3:58 am

    If I understand correctly then I would define the % chance of winning as a decimal and then rely on Rand(), though this still doesn’t feel ideal

    <cfscript>
        numChanceToWin = 0.15;  // <= this == winner == 15% chance to win
        numRandom = Rand(); // decimal from 0 to 1
    
        if (numRandom <= numChanceToWin ) {
            // Winner
        } else {
            // Loser
        }
    <cfscript>
    

    Also works with your 1/8 definition by setting numChanceToWin = 1/8; or even if (numRandom/numChanceToWin <= 1) { // Winner

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

So, I was going over some old code I wrote about 5 years ago
I was going over some sample questions for an upcoming test, and this question
So I'm working on some code (going over a practice exam for a course
I hav been going over some old hw assignments from a class last semester.
I've taken over some old legacy JSP code and wanted to add some mail
I recently stumbled over a problem caused by some very old code I wrote
I am going over some code written by another developer and am not sure
Been going over my predecessor's code and see usage of the request scope frequently.
I am going over/studying the facebook code that was leaked in 2007, I notice
I'm going back over an old project where I added preprocessor functionality to Essence'

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.