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 9106523
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 17, 20262026-06-17T02:21:28+00:00 2026-06-17T02:21:28+00:00

i am having total no of elements(say 500) in a java class, which will

  • 0

i am having total no of elements(say 500) in a java class, which will generate a population of 3 diff type (type A,Type B and Type C) of objects with a probability of A=0.3,B=0.2,C=0.5. i am not able to find a nice and easy solution ,can any one help me with a sample code or some reference

Thanks in advance

  • 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-17T02:21:29+00:00Added an answer on June 17, 2026 at 2:21 am

    For each element, generate a random int r between 0 and 9.

    If 0 <= r < 3 then Type A.
    If 3 <= r < 5 then Type B.
    If 5 <= r < 10 then Type C.
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I'm a total newbie at Entity Framework and ASP.Net MVC, having learned mostly from
Having trouble with each function... Will try to explain by example... In my code,
I have been having this problem in IE. I have two divs which I
I am having some trouble figuring out how to get the number of elements
For some reason, I'm having trouble getting an accurate height value for elements in
I'm using SQLCommand in C# to run SQL against a local machine which will
I am having simple code of paralellizing QuickSort algorithm in Java, in run method
Having a problem with the change() event in jQuery : $(select[name=cmm]).change(function(){ total(); }); For
Given a set** S containing duplicate elements, how can one determine the total number
Total XAML noob here. I'm having problems determining the proper way to change the

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.